I am destroying a programmatically created fragment with:
getFragmentManager().beginTransaction().remove(getFragmentManager().findFragmentById(R.id.test)).commit();
Which is determined in the xml file like this:
<LinearLayout
android:id="@+id/test"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>
If I then create a fragment from the same class again in the mainactivity:
getSupportFragmentManager().beginTransaction()
.add(R.id.result_bar, testinstance)
.commit();
Then onCreate seem not called again (the fragment is just empty). What am I doing wrong here? Thanks.