Back to project page android-shuite-smoking.
The source code is released under:
GNU General Public License
If you think the Android project android-shuite-smoking listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package udl.eps.smokerscontrol; //from w ww . j a v a 2s .c o m import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; public class MainActivity extends BaseActivity implements MenuFragment.ButtonListener { private MenuFragment menuFragment; private StatsFragment statsFragment; private FragmentTransaction ft; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); menuFragment = new MenuFragment(); getFragmentManager().popBackStackImmediate(); ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.frameLayout, menuFragment, "fragment"); //ft.addToBackStack("fragment"); ft.commit(); menuFragment.setButtonListener(this); } @Override protected int getLayoutResourceId() { return R.layout.activity_main; } @Override public void onItemSelected(Fragment fragment) { ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.frameLayout, fragment, "fragment"); ft.addToBackStack("main"); ft.commit(); } @Override public void onBackPressed() { super.onBackPressed(); } }