Java Code Examples for android.support.v4.app.FragmentManager

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Ohmage_Phone, under directory /src/com/slezica/tools/async/.

Source file: ManagedAsyncTask.java

  24 
vote

public ManagedAsyncTask(FragmentActivity activity,String fragmentTag){
  FragmentManager fragmentManager=activity.getSupportFragmentManager();
  mManager=(TaskManagerFragment)fragmentManager.findFragmentByTag(fragmentTag);
  if (mManager == null) {
    mManager=new TaskManagerFragment();
    fragmentManager.beginTransaction().add(mManager,fragmentTag).commit();
  }
  mTask=new InternalAsyncTask();
}
 

Example 2

From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/ui/tablet/.

Source file: NowPlayingMultiPaneActivity.java

  23 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent intent=new Intent();
  intent.setData(Sessions.buildSessionsAtDirUri(System.currentTimeMillis()));
  setContentView(R.layout.activity_now_playing);
  final FragmentManager fm=getSupportFragmentManager();
  mSessionsFragment=(SessionsFragment)fm.findFragmentByTag("sessions");
  if (mSessionsFragment == null) {
    mSessionsFragment=new SessionsFragment();
    mSessionsFragment.setArguments(intentToFragmentArguments(intent));
    fm.beginTransaction().add(R.id.fragment_container_sessions,mSessionsFragment,"sessions").commit();
  }
}
 

Example 3

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentHideShowSupport.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(SampleList.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_hide_show_support);
  FragmentManager fm=getSupportFragmentManager();
  addShowHideListener(R.id.frag1hide,fm.findFragmentById(R.id.fragment1));
  addShowHideListener(R.id.frag2hide,fm.findFragmentById(R.id.fragment2));
}
 

Example 4

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: WebActivity.java

  22 
vote

@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final FragmentManager fragmentManager=getSupportFragmentManager();
  final FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
  final Fragment fragment=WebFragment.newInstance(url);
  fragmentTransaction.replace(android.R.id.content,fragment,"fragment");
  fragmentTransaction.commit();
}
 

Example 5

From project Airports, under directory /src/com/nadmm/airports/.

Source file: ActivityBase.java

  22 
vote

protected Fragment addFragment(Class<?> clss,Bundle args,int id){
  String tag=clss.getSimpleName();
  FragmentManager fm=getSupportFragmentManager();
  Fragment f=fm.findFragmentByTag(tag);
  if (f == null) {
    f=Fragment.instantiate(this,clss.getName(),args);
    FragmentTransaction ft=fm.beginTransaction();
    ft.add(id,f,tag);
    ft.commit();
  }
  return f;
}
 

Example 6

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: AmenDetailFragmentActivity.java

  22 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.d(TAG,"--> onCreate");
  setContentView(R.layout.activity_fragment_amen_detail);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  actionBar.setTitle("Amendetails");
  FragmentManager fragmentManager=getSupportFragmentManager();
  amenDetailFragment=(AmenDetailFragment)fragmentManager.findFragmentById(R.id.activity_fragment_amen_detail);
}
 

Example 7

From project Android, under directory /app/src/main/java/com/github/mobile/ui/.

Source file: DialogFragmentHelper.java

  22 
vote

/** 
 * Show dialog
 * @param activity
 * @param fragment
 * @param arguments
 * @param tag
 */
protected static void show(DialogFragmentActivity activity,DialogFragmentHelper fragment,Bundle arguments,String tag){
  FragmentManager manager=activity.getSupportFragmentManager();
  FragmentTransaction transaction=manager.beginTransaction();
  Fragment current=manager.findFragmentByTag(tag);
  if (current != null)   transaction.remove(current);
  transaction.addToBackStack(null);
  fragment.setArguments(arguments);
  fragment.show(manager,tag);
}
 

Example 8

From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/ui/tablet/.

Source file: NowPlayingMultiPaneActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent intent=new Intent();
  intent.setData(Sessions.buildSessionsAtDirUri(System.currentTimeMillis()));
  setContentView(R.layout.activity_now_playing);
  final FragmentManager fm=getSupportFragmentManager();
  mSessionsFragment=(SessionsFragment)fm.findFragmentByTag("sessions");
  if (mSessionsFragment == null) {
    mSessionsFragment=new SessionsFragment();
    mSessionsFragment.setArguments(intentToFragmentArguments(intent));
    fm.beginTransaction().add(R.id.fragment_container_sessions,mSessionsFragment,"sessions").commit();
  }
}
 

Example 9

From project blogActivity, under directory /src/com/slezica/tools/async/.

Source file: ManagedAsyncTask.java

  22 
vote

public ManagedAsyncTask(FragmentActivity activity,String fragmentTag){
  FragmentManager fragmentManager=activity.getSupportFragmentManager();
  mManager=(TaskManagerFragment)fragmentManager.findFragmentByTag(fragmentTag);
  if (mManager == null) {
    mManager=new TaskManagerFragment();
    fragmentManager.beginTransaction().add(mManager,fragmentTag).commit();
  }
  mTask=new InternalAsyncTask();
}
 

Example 10

From project cw-advandroid, under directory /Honeycomb/FeedFragments/src/com/commonsware/android/feedfrags/.

Source file: AbstractFeedsActivity.java

  22 
vote

public void onItemSelected(RSSItem item){
  FragmentManager fragMgr=getSupportFragmentManager();
  ContentFragment content=(ContentFragment)fragMgr.findFragmentById(R.id.third_pane);
  FragmentTransaction xaction=fragMgr.beginTransaction();
  if (content == null || content.isRemoving()) {
    content=new ContentFragment(item.getLink().toString());
    xaction.add(R.id.third_pane,content).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).addToBackStack(null).commit();
  }
 else {
    content.loadUrl(item.getLink().toString());
  }
}
 

Example 11

From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/ui/.

Source file: HomeActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  AnalyticsUtils.getInstance(this).trackPageView("/Home");
  setContentView(R.layout.activity_home);
  getActivityHelper().setupActionBar(null,0);
  FragmentManager fm=getSupportFragmentManager();
  mTagStreamFragment=(TagStreamFragment)fm.findFragmentById(R.id.fragment_tag_stream);
  mSyncStatusUpdaterFragment=(SyncStatusUpdaterFragment)fm.findFragmentByTag(SyncStatusUpdaterFragment.TAG);
  if (mSyncStatusUpdaterFragment == null) {
    mSyncStatusUpdaterFragment=new SyncStatusUpdaterFragment();
    fm.beginTransaction().add(mSyncStatusUpdaterFragment,SyncStatusUpdaterFragment.TAG).commit();
    triggerRefresh();
  }
}
 

Example 12

From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/ui/.

Source file: StarredActivity.java

  22 
vote

private void setupContent(){
  FrameLayout fragmentContainer=new FrameLayout(this);
  fragmentContainer.setId(R.id.fragment_sessions);
  fragmentContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT));
  ((ViewGroup)findViewById(R.id.starredcontent)).addView(fragmentContainer);
  final Intent intent=new Intent(Intent.ACTION_VIEW,Sessions.CONTENT_STARRED_URI);
  final FragmentManager fm=getSupportFragmentManager();
  mSessionsFragment=(SessionsFragment)fm.findFragmentByTag("sessions");
  if (mSessionsFragment == null) {
    mSessionsFragment=new SessionsFragment();
    mSessionsFragment.setArguments(intentToFragmentArguments(intent));
    fm.beginTransaction().add(R.id.fragment_sessions,mSessionsFragment,"sessions").commit();
  }
}
 

Example 13

From project droidparts, under directory /modern/src/org/droidparts/activity/.

Source file: FragmentActivity.java

  22 
vote

public void setFragmentVisible(int fragmentId,boolean visible){
  FragmentManager fm=getSupportFragmentManager();
  Fragment f=fm.findFragmentById(fragmentId);
  if (f != null) {
    FragmentTransaction ft=fm.beginTransaction();
    if (visible) {
      ft.show(f);
    }
 else {
      ft.hide(f);
    }
    ft.commit();
  }
}
 

Example 14

From project Ebento, under directory /src/mobisocial/bento/ebento/ui/.

Source file: EditActivity.java

  22 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  boolean bNewEventMode=true;
  if (getIntent().hasExtra(EXTRA_EDIT)) {
    bNewEventMode=false;
  }
  setContentView(R.layout.activity_edit);
  FragmentManager fm=getSupportFragmentManager();
  mEditFragment=(EditFragment)fm.findFragmentById(R.id.fragment_edit);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  actionBar.setDisplayUseLogoEnabled(true);
  actionBar.setTitle(bNewEventMode ? R.string.label_create_event : R.string.label_edit_event);
}
 

Example 15

From project ElectricSleep, under directory /src/com/androsz/electricsleepbeta/app/.

Source file: HistoryActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  FragmentManager manager=getSupportFragmentManager();
  if (manager.findFragmentById(android.R.id.content) == null) {
    manager.beginTransaction().add(android.R.id.content,new HistoryListFragment()).commit();
  }
}
 

Example 16

From project evodroid, under directory /src/com/sonorth/evodroid/.

Source file: Comments.java

  22 
vote

protected void popCommentDetail(){
  FragmentManager fm=getSupportFragmentManager();
  ViewCommentFragment f=(ViewCommentFragment)fm.findFragmentById(R.id.commentDetail);
  if (f == null) {
    fm.popBackStack();
  }
}
 

Example 17

From project examples_2, under directory /BackgroundThreadFragment/src/com/inazaruk/backgroundthread/.

Source file: MainActivity.java

  22 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  FragmentManager manager=getSupportFragmentManager();
  FragmentTransaction transaction=manager.beginTransaction();
  mBkthreadFragment=new BackgroundThreadFragment();
  transaction.add(R.id.bkthread,mBkthreadFragment);
  transaction.commit();
}
 

Example 18

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentHideShowSupport.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(SampleList.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_hide_show_support);
  FragmentManager fm=getSupportFragmentManager();
  addShowHideListener(R.id.frag1hide,fm.findFragmentById(R.id.fragment1));
  addShowHideListener(R.id.frag2hide,fm.findFragmentById(R.id.fragment2));
}
 

Example 19

From project Funf-Ohmage, under directory /src/com/slezica/tools/async/.

Source file: ManagedAsyncTask.java

  22 
vote

public ManagedAsyncTask(FragmentActivity activity,String fragmentTag){
  FragmentManager fragmentManager=activity.getSupportFragmentManager();
  mManager=(TaskManagerFragment)fragmentManager.findFragmentByTag(fragmentTag);
  if (mManager == null) {
    mManager=new TaskManagerFragment();
    fragmentManager.beginTransaction().add(mManager,fragmentTag).commit();
  }
  mTask=new InternalAsyncTask();
}
 

Example 20

From project gddsched2, under directory /trunk/android/src/com/google/android/apps/iosched2/ui/.

Source file: HomeActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  SetupHelper.loadCurrentSetup(this);
  setContentView(R.layout.activity_home);
  getActivityHelper().setupActionBar(null,0);
  FragmentManager fm=getSupportFragmentManager();
  mTagStreamFragment=(TagStreamFragment)fm.findFragmentById(R.id.fragment_tag_stream);
  mSyncStatusUpdaterFragment=(SyncStatusUpdaterFragment)fm.findFragmentByTag(SyncStatusUpdaterFragment.TAG);
  if (mSyncStatusUpdaterFragment == null) {
    mSyncStatusUpdaterFragment=new SyncStatusUpdaterFragment();
    fm.beginTransaction().add(mSyncStatusUpdaterFragment,SyncStatusUpdaterFragment.TAG).commit();
    triggerRefresh();
  }
}
 

Example 21

From project GnucashMobile, under directory /GnucashMobile/src/org/gnucash/android/ui/accounts/.

Source file: AccountsActivity.java

  22 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    FragmentManager fm=getSupportFragmentManager();
  if (fm.getBackStackEntryCount() > 0) {
    fm.popBackStack();
  }
return true;
default :
return false;
}
}
 

Example 22

From project iosched, under directory /android/src/com/google/android/apps/iosched/ui/.

Source file: SearchActivity.java

  22 
vote

/** 
 * Build and add "sessions" tab.
 */
private void setupSessionsTab(){
  FrameLayout fragmentContainer=new FrameLayout(this);
  fragmentContainer.setId(R.id.fragment_sessions);
  fragmentContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT));
  ((ViewGroup)findViewById(android.R.id.tabcontent)).addView(fragmentContainer);
  final FragmentManager fm=getSupportFragmentManager();
  mSessionsFragment=(SessionsFragment)fm.findFragmentByTag("sessions");
  if (mSessionsFragment == null) {
    mSessionsFragment=new SessionsFragment();
    mSessionsFragment.setArguments(getSessionsFragmentArguments());
    fm.beginTransaction().add(R.id.fragment_sessions,mSessionsFragment,"sessions").commit();
  }
  mTabHost.addTab(mTabHost.newTabSpec(TAG_SESSIONS).setIndicator(buildIndicator(R.string.starred_sessions)).setContent(R.id.fragment_sessions));
}
 

Example 23

From project iosched2011, under directory /android/src/com/google/android/apps/iosched/ui/.

Source file: SearchActivity.java

  22 
vote

/** 
 * Build and add "sessions" tab.
 */
private void setupSessionsTab(){
  FrameLayout fragmentContainer=new FrameLayout(this);
  fragmentContainer.setId(R.id.fragment_sessions);
  fragmentContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT));
  ((ViewGroup)findViewById(android.R.id.tabcontent)).addView(fragmentContainer);
  final FragmentManager fm=getSupportFragmentManager();
  mSessionsFragment=(SessionsFragment)fm.findFragmentByTag("sessions");
  if (mSessionsFragment == null) {
    mSessionsFragment=new SessionsFragment();
    mSessionsFragment.setArguments(getSessionsFragmentArguments());
    fm.beginTransaction().add(R.id.fragment_sessions,mSessionsFragment,"sessions").commit();
  }
  mTabHost.addTab(mTabHost.newTabSpec(TAG_SESSIONS).setIndicator(buildIndicator(R.string.starred_sessions)).setContent(R.id.fragment_sessions));
}
 

Example 24

From project iosched_2, under directory /android/src/com/google/android/apps/iosched/ui/tablet/.

Source file: NowPlayingMultiPaneActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent intent=new Intent();
  intent.setData(Sessions.buildSessionsAtDirUri(System.currentTimeMillis()));
  setContentView(R.layout.activity_now_playing);
  final FragmentManager fm=getSupportFragmentManager();
  mSessionsFragment=(SessionsFragment)fm.findFragmentByTag("sessions");
  if (mSessionsFragment == null) {
    mSessionsFragment=new SessionsFragment();
    mSessionsFragment.setArguments(intentToFragmentArguments(intent));
    fm.beginTransaction().add(R.id.fragment_container_sessions,mSessionsFragment,"sessions").commit();
  }
}
 

Example 25

From project iosched_3, under directory /android/src/com/google/android/apps/iosched/ui/phone/.

Source file: VendorDetailActivity.java

  22 
vote

@Override public void onTrackIdAvailable(final String trackId){
  new Handler().post(new Runnable(){
    @Override public void run(){
      FragmentManager fm=getSupportFragmentManager();
      if (fm.findFragmentByTag("track_info") == null) {
        fm.beginTransaction().add(TrackInfoHelperFragment.newFromTrackUri(ScheduleContract.Tracks.buildTrackUri(trackId)),"track_info").commit();
      }
    }
  }
);
}
 

Example 26

From project k-9, under directory /src/com/fsck/k9/fragment/.

Source file: MessageViewFragment.java

  22 
vote

private void removeDialog(int dialogId){
  FragmentManager fm=getFragmentManager();
  fm.executePendingTransactions();
  DialogFragment fragment=(DialogFragment)fm.findFragmentByTag(getDialogTag(dialogId));
  if (fragment != null) {
    fragment.dismiss();
  }
}
 

Example 27

From project maven-android-plugin-samples, under directory /support4demos/src/com/example/android/supportv4/app/.

Source file: FragmentHideShowSupport.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_hide_show_support);
  FragmentManager fm=getSupportFragmentManager();
  addShowHideListener(R.id.frag1hide,fm.findFragmentById(R.id.fragment1));
  addShowHideListener(R.id.frag2hide,fm.findFragmentById(R.id.fragment2));
}
 

Example 28

From project mWater-Android-App, under directory /android/src/co/mwater/clientapp/ui/.

Source file: SourceListActivity.java

  22 
vote

void createNewSource(){
  if (!SourceCodes.anyCodesAvailable(this)) {
    SourceCreateDialog.showNoSourcesErrorDialog(this);
    return;
  }
  FragmentManager fm=getSupportFragmentManager();
  SourceCreateDialog createDialog=new SourceCreateDialog();
  createDialog.show(fm,"dialog_create");
}
 

Example 29

From project ohmagePhone, under directory /src/com/slezica/tools/async/.

Source file: ManagedAsyncTask.java

  22 
vote

public ManagedAsyncTask(FragmentActivity activity,String fragmentTag){
  FragmentManager fragmentManager=activity.getSupportFragmentManager();
  mManager=(TaskManagerFragment)fragmentManager.findFragmentByTag(fragmentTag);
  if (mManager == null) {
    mManager=new TaskManagerFragment();
    fragmentManager.beginTransaction().add(mManager,fragmentTag).commit();
  }
  mTask=new InternalAsyncTask();
}
 

Example 30

From project onebusaway-android, under directory /src/com/joulespersecond/seattlebusbot/.

Source file: ArrivalsListActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  UIHelp.setupActionBar(this);
  FragmentManager fm=getSupportFragmentManager();
  if (fm.findFragmentById(android.R.id.content) == null) {
    ArrivalsListFragment list=new ArrivalsListFragment();
    list.setArguments(FragmentUtils.getIntentArgs(getIntent()));
    fm.beginTransaction().add(android.R.id.content,list).commit();
  }
}
 

Example 31

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: EquipmentSetEditActivity.java

  21 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.equipmentseteditactivity);
  notifyDatasetChanged();
  FragmentManager fm=getSupportFragmentManager();
  FFXIEQFragment.OnDatasetChangedListener listener=new FFXIEQFragment.OnDatasetChangedListener(){
    @Override public void notifyDatasetChanged(){
      EquipmentSetEditActivity.this.notifyDatasetChanged();
    }
  }
;
{
    EquipmentSetEditFragment fragment=(EquipmentSetEditFragment)fm.findFragmentById(R.id.CharacterEdit);
    if (fragment != null)     fragment.setOnDatasetChangedListener(listener);
  }
{
    MagicSetEditFragment fragment=(MagicSetEditFragment)fm.findFragmentById(R.id.MagicEdit);
    if (fragment != null)     fragment.setOnDatasetChangedListener(listener);
  }
{
    CharacterStatusFragment fragment=(CharacterStatusFragment)fm.findFragmentById(R.id.CharacterStatus);
    if (fragment != null)     fragment.setOnDatasetChangedListener(listener);
  }
{
    BasicEditFragment fragment=(BasicEditFragment)fm.findFragmentById(R.id.BasicEdit);
    if (fragment != null)     fragment.setOnDatasetChangedListener(listener);
  }
}
 

Example 32

From project android-flash-cards, under directory /src/org/thomasamsler/android/flashcards/activity/.

Source file: MainActivity.java

  21 
vote

private void showCardSetsFragment(boolean addToBackStack){
  FragmentManager fragmentManager=getSupportFragmentManager();
  FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
  if (null == mActionbarFragment) {
    mActionbarFragment=ActionbarFragment.newInstance(LIST_FRAGMENT);
    fragmentTransaction.replace(R.id.actionbarContainer,mActionbarFragment);
  }
 else {
    mActionbarFragment.configureFor(LIST_FRAGMENT);
  }
  if (null == mCardSetsFragment) {
    mCardSetsFragment=new CardSetsFragment();
  }
  fragmentTransaction.replace(R.id.fragmentContainer,mCardSetsFragment);
  if (addToBackStack) {
    fragmentTransaction.addToBackStack(null);
  }
  fragmentTransaction.commit();
  mFragmentContainer.setVisibility(View.VISIBLE);
  mViewPager.setVisibility(View.GONE);
  mHelpContext=HELP_CONTEXT_CARD_SET_LIST;
  mActiveFragmentReference=LIST_FRAGMENT;
  mExitOnBackPressed=true;
}
 

Example 33

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/remotesandbox/ui/base/.

Source file: ReloadableActionBarActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getActionBarHelper().setRefreshActionItemState(mSyncing);
  final FragmentManager fm=getSupportFragmentManager();
  final AbstractSyncBridge[] bridges=initSyncBridges();
  FragmentTransaction ft=null;
  for (  AbstractSyncBridge syncBridge : bridges) {
    if (ft == null) {
      ft=fm.beginTransaction();
    }
    AbstractSyncBridge checkSyncBridge=(AbstractSyncBridge)fm.findFragmentByTag(syncBridge.getTagName());
    if (checkSyncBridge != null) {
      ft.remove(checkSyncBridge);
      Log.i(TAG,"Updated refresh observers.");
      syncBridge.setRefreshObservers(mRefreshObservers);
    }
    Log.i(TAG,"Added " + syncBridge.getClass().getSimpleName() + " fragment to activity.");
    ft.add(syncBridge,syncBridge.getTagName());
  }
  if (ft != null) {
    ft.commit();
  }
}
 

Example 34

From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/activity/feed/.

Source file: FeedFragment.java

  21 
vote

public boolean handleSelectedContextItem(AdapterView.AdapterContextMenuInfo info,MenuItem item){
  try {
    FeedItem feedItem=(FeedItem)info.targetView.getTag();
    if (item.getItemId() == CONTEXT_ID_HOOAH) {
      new AsyncFeedHooah(mContext,info.id,false,feedItem.isLiked(),this).execute(mSharedPreferences.getString(Constants.SP_BL_PROFILE_CHECKSUM,""));
    }
 else     if (item.getItemId() == CONTEXT_ID_SINGLE) {
      startActivity(new Intent(mContext,SinglePostActivity.class).putExtra("feed",feedItem).putExtra("canComment",mWrite));
    }
 else     if (item.getItemId() == CONTEXT_ID_VIEW_HOOAH) {
      FragmentManager manager=getFragmentManager();
      HooahListDialogFragment dialog=HooahListDialogFragment.newInstance(feedItem,getTag());
      dialog.show(manager,"profile_dialog");
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    return false;
  }
  return true;
}
 

Example 35

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: WalletActivity.java

  21 
vote

@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ErrorReporter.getInstance().check(this);
  setContentView(R.layout.wallet_content);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setTitle(R.string.app_name);
  final boolean twoPanes=findViewById(R.id.wallet_main_twopanes) != null;
  if (!twoPanes) {
    final FragmentManager fm=getSupportFragmentManager();
    final FragmentTransaction ft=fm.beginTransaction();
    ft.hide(fm.findFragmentById(R.id.exchange_rates_fragment));
    ft.commit();
  }
  checkVersionAndTimeskewAlert();
  touchLastUsed();
}
 

Example 36

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: BranchViewer.java

  19 
vote

public BranchPagerAdapter(FragmentManager fm,Resources resources,File gitdir,Ref branch){
  super(fm);
  this.resources=resources;
  this.gitdir=gitdir;
  this.branch=branch;
}
 

Example 37

From project android_7, under directory /src/org/immopoly/android/app/.

Source file: ImmopolyActivity.java

  19 
vote

/** 
 * Init the game
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mTracker=GoogleAnalyticsTracker.getInstance();
  mTracker.startNewSession(TrackingManager.UA_ACCOUNT,Const.ANALYTICS_INTERVAL,getApplicationContext());
  UserDataManager.instance.setActivity(this);
  setContentView(R.layout.immopoly_activity);
  mTabHost=(TabHost)findViewById(android.R.id.tabhost);
  mTabHost.setup();
  mTabManager=new TabManager(this,mTabHost,R.id.fragment_container);
  addTab(R.drawable.ic_tab_map,FRAGMENT_MAP,MapFragment.class,false);
  addTab(R.drawable.ic_tab_portfolio,"portfolio",PortfolioListFragment.class,false);
  addTab(R.drawable.ic_tab_portfolio,"portfolio_map",PortfolioMapFragment.class,true);
  addTab(R.drawable.ic_tab_profile,"profile",ProfileFragment.class,false);
  addTab(R.drawable.ic_tab_history,"history",HistoryFragment.class,false);
  FragmentManager.enableDebugLogging(true);
  if (savedInstanceState != null) {
    mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
  }
 else {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    if (prefs.getBoolean("showFirstAid",true)) {
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          new FirstAidDialog(ImmopolyActivity.this).show();
        }
      }
,4000);
    }
  }
  VERISONINFO=getVersionInfo();
}
 

Example 38

From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/ui/.

Source file: FeedHomeActivity.java

  19 
vote

public FeedFragmentAdapter(FragmentManager fm,Uri feedUri){
  super(fm);
  NUM_ITEMS=mFeedViews.size();
  for (  FeedView f : mFeedViews) {
    mFragments.add(f.getFragment());
  }
}