Reputation: 856
When I start a fragment from the activity, The methods onCreate(), onViewCreated() are invoked twice.
Here's my code:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chapter_list);
FragmentManager frgManager = getSupportFragmentManager();
if (findViewById(R.id.fl_chapter_detail) != null)
{
mbThreePaneLayout = true;
FragmentChapterList frgChapterList = (FragmentChapterList) frgManager.findFragmentById(R.id.frg_chapter_list);
frgChapterList.setActivateOnItemClick(true);
}
if (savedInstanceState == null)
{
String strSelectedSection = getIntent().getStringExtra(Konstant.KEY_SELECTED_SECTION);
if (((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE) || (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT))
currentActionBar.setTitle(strSelectedSection);
Bundle arguments = new Bundle();
arguments.putString(Konstant.KEY_SELECTED_SECTION, strSelectedSection);
FragmentChapterList frgChapterList = new FragmentChapterList();
frgChapterList.setArguments(arguments);
FragmentTransaction frgTransaction = frgManager.beginTransaction();
frgTransaction.add(R.id.frg_chapter_list, frgChapterList).commit();
}
}
Does anyone have idea why it's happening?
Upvotes: 0
Views: 211
Reputation: 5373
To fix this:
name
attribute.For more information see: InflateException Caused by <fragment> Tag Without a Bound Class
Upvotes: 2