Android Open Source - android-shuite-smoking Main Activity






From Project

Back to project page android-shuite-smoking.

License

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.

Java Source Code

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();
    }
}




Java Source Code List

udl.eps.smokerscontrol.ApplicationTest.java
udl.eps.smokerscontrol.BaseActivity.java
udl.eps.smokerscontrol.CommunityFragment.java
udl.eps.smokerscontrol.ImageButtonAdapter.java
udl.eps.smokerscontrol.ImageButton.java
udl.eps.smokerscontrol.MainActivity.java
udl.eps.smokerscontrol.MenuFragment.java
udl.eps.smokerscontrol.StatsFragment.java