I am trying to get a specific fragment with:
RohwareFragmentMatlist fragment = (RohwareFragmentMatlist)getFragmentManager().findFragmentById(R.id.lagerfragment);
But I get an error message from eclipse with this message:
Cannot be dropped from fragment in RohwareFragmentMatlist
Activity starts with:
public class RohwareActionBar extends FragmentActivity {...
RohwareFragmentMatlist is defined as follows:
public class RohwareFragmentMatlist extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor>{...
A fragment is defined as follows:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:name="de.ypssoft.RohwareFragmentMatlist" android:layout_weight="1" android:layout_width="0px" android:layout_height="match_parent" android:id="@+id/lagerfragment" android:layout_margin="5dip" android:layout_marginLeft="10dip" > </fragment> <FrameLayout android:id="@+id/details" android:layout_weight="3" android:layout_width="0px" android:layout_height="match_parent" android:background="?android:attr/detailsElementBackground" /> </LinearLayout>
Does it work to get the fragment through "getFragmentById" using ListFragment?
Kay gladen
source share