-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainActivity.java
76 lines (59 loc) · 2.21 KB
/
MainActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.example.itcapstone.burglarkitten;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
/*
* Created by Mohamed Hassenjee, Ky Duong
* Date 7/19/2016
*
* For: Valencia College
* Class: IT Capstone
* Professor: Kalysa Wilson
*
* */
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onBackPressed() {
FragmentManager fragmentManager = getSupportFragmentManager();
if(fragmentManager.getBackStackEntryCount() != 0) {
fragmentManager.popBackStack();
} else {
super.onBackPressed();
}
}
public void QuestionActivity(View v){
Intent intent = new Intent(this, QuestionActivity.class);
startActivity(intent);
}
public void AboutUs(View v){
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
AboutUs fragment = new AboutUs();
fragmentTransaction.add(R.id.main_layout, fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
public void Chat(View v){
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
MainChatFragment fragment = new MainChatFragment();
fragmentTransaction.add(R.id.main_layout, fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
public void ContactUs(View v){
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
ContactUs fragment = new ContactUs();
fragmentTransaction.add(R.id.main_layout, fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
}