public void cancelHandler(View v) { FragmentManager fm = getSupportFragmentManager(); AddBookmarkFragment addFrag = (AddBookmarkFragment) fm.findFragmentById(R.id.addcontent); if (addFrag != null) { addFrag.cancelHandler(v); } }
public void onBookmarkEdit(Bookmark b) { if (b != null) { if (findViewById(R.id.maincontent) != null) { AddBookmarkFragment addFrag = (AddBookmarkFragment) getSupportFragmentManager().findFragmentById(R.id.addcontent); addFrag.loadBookmark(b, null); addFrag.refreshView(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (getSupportFragmentManager().findFragmentById(R.id.tagcontent).isVisible()) { transaction.hide(getSupportFragmentManager().findFragmentById(R.id.tagcontent)); transaction.show(getSupportFragmentManager().findFragmentById(R.id.maincontent)); transaction.addToBackStack(null); } transaction.show(getSupportFragmentManager().findFragmentById(R.id.addcontent)); transaction.commit(); transaction = getSupportFragmentManager().beginTransaction(); transaction.hide(getSupportFragmentManager().findFragmentById(R.id.maincontent)); transaction.commit(); } else { startActivity(IntentHelper.EditBookmark(b, mAccount.name, this)); } } }