Android Open Source - fieldreporter Single Fragment Activity






From Project

Back to project page fieldreporter.

License

The source code is released under:

Apache License

If you think the Android project fieldreporter 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 com.donnemartin.android.fieldreporter;
/*from  w w  w .java  2  s.  c o  m*/

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.widget.FrameLayout;

public abstract class SingleFragmentActivity extends FragmentActivity {
    protected static final String FRAGMENT_TAG = "SingleFragmentActivity.Fragment";
    
    protected abstract Fragment createFragment();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FrameLayout fl = new FrameLayout(this);
        fl.setId(R.id.fragmentContainer);
        setContentView(fl);
        
        FragmentManager manager = getSupportFragmentManager();
        Fragment fragment = manager.findFragmentById(R.id.fragmentContainer);

        if (fragment == null) {
            fragment = createFragment();
            manager.beginTransaction()
                .add(R.id.fragmentContainer, fragment)
                .commit();
        }
    }
}




Java Source Code List

android.UnusedStub.java
com.donnemartin.android.fieldreporter.DataLoader.java
com.donnemartin.android.fieldreporter.LastLocationLoader.java
com.donnemartin.android.fieldreporter.LocationListCursorLoader.java
com.donnemartin.android.fieldreporter.LocationReceiver.java
com.donnemartin.android.fieldreporter.ReportActivity.java
com.donnemartin.android.fieldreporter.ReportDatabaseHelper.java
com.donnemartin.android.fieldreporter.ReportFragment.java
com.donnemartin.android.fieldreporter.ReportListActivity.java
com.donnemartin.android.fieldreporter.ReportListFragment.java
com.donnemartin.android.fieldreporter.ReportLoader.java
com.donnemartin.android.fieldreporter.ReportManager.java
com.donnemartin.android.fieldreporter.ReportMapActivity.java
com.donnemartin.android.fieldreporter.ReportMapFragment.java
com.donnemartin.android.fieldreporter.Report.java
com.donnemartin.android.fieldreporter.SQLiteCursorLoader.java
com.donnemartin.android.fieldreporter.SingleFragmentActivity.java
com.donnemartin.android.fieldreporter.TrackingLocationReceiver.java