use of android.support.v4.app.FragmentTransaction in project Android-Developers-Samples by johnjohndoe.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
CardEmulationFragment fragment = new CardEmulationFragment();
transaction.replace(R.id.sample_content_fragment, fragment);
transaction.commit();
}
use of android.support.v4.app.FragmentTransaction in project Android-Developers-Samples by johnjohndoe.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
CardReaderFragment fragment = new CardReaderFragment();
transaction.replace(R.id.sample_content_fragment, fragment);
transaction.commit();
}
use of android.support.v4.app.FragmentTransaction in project Android-Developers-Samples by johnjohndoe.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager fm = getSupportFragmentManager();
BatchStepSensorFragment fragment = (BatchStepSensorFragment) fm.findFragmentByTag(FRAGTAG);
if (fragment == null) {
FragmentTransaction transaction = fm.beginTransaction();
fragment = new BatchStepSensorFragment();
transaction.add(fragment, FRAGTAG);
transaction.commit();
}
// Use fragment as click listener for cards, but must implement correct interface
if (!(fragment instanceof OnCardClickListener)) {
throw new ClassCastException("BatchStepSensorFragment must " + "implement OnCardClickListener interface.");
}
OnCardClickListener clickListener = (OnCardClickListener) fm.findFragmentByTag(FRAGTAG);
mRetentionFragment = (StreamRetentionFragment) fm.findFragmentByTag(RETENTION_TAG);
if (mRetentionFragment == null) {
mRetentionFragment = new StreamRetentionFragment();
fm.beginTransaction().add(mRetentionFragment, RETENTION_TAG).commit();
} else {
// If the retention fragment already existed, we need to pull some state.
// pull state out
CardStreamState state = mRetentionFragment.getCardStream();
// dump it in CardStreamFragment.
mCardStreamFragment = (CardStreamFragment) fm.findFragmentById(R.id.fragment_cardstream);
mCardStreamFragment.restoreState(state, clickListener);
}
}
use of android.support.v4.app.FragmentTransaction in project SeriesGuide by UweTrottmann.
the class ExtensionsConfigurationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_singlepane);
setupActionBar();
if (getIntent().hasExtra(SeriesGuideExtension.EXTRA_FROM_SERIESGUIDE_SETTINGS)) {
// launch Amazon extension settings instead
if (savedInstanceState == null) {
AmazonConfigurationFragment f = new AmazonConfigurationFragment();
android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.content_frame, f);
ft.commit();
}
} else {
if (savedInstanceState == null) {
ExtensionsConfigurationFragment f = new ExtensionsConfigurationFragment();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.content_frame, f);
ft.commit();
}
}
}
use of android.support.v4.app.FragmentTransaction in project SeriesGuide by UweTrottmann.
the class OverviewActivity method setupPanes.
private void setupPanes() {
Fragment showsFragment = ShowFragment.newInstance(showTvdbId);
FragmentTransaction ft1 = getSupportFragmentManager().beginTransaction();
ft1.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
ft1.replace(R.id.fragment_show, showsFragment);
ft1.commit();
Fragment overviewFragment = OverviewFragment.newInstance(showTvdbId);
FragmentTransaction ft2 = getSupportFragmentManager().beginTransaction();
ft2.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
ft2.replace(R.id.fragment_overview, overviewFragment);
ft2.commit();
Fragment seasonsFragment = SeasonsFragment.newInstance(showTvdbId);
FragmentTransaction ft3 = getSupportFragmentManager().beginTransaction();
ft3.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
ft3.replace(R.id.fragment_seasons, seasonsFragment);
ft3.commit();
}
Aggregations