Staram się specyficzny fragment z:ClassCastException z findFragmentById
RohwareFragmentMatlist fragment = (RohwareFragmentMatlist)getFragmentManager().findFragmentById(R.id.lagerfragment);
Ale pojawia się błąd z zaćmienia z tej wiadomości:
Nie można przesyłać z fragmentu RohwareFragmentMatlist
Aktywność rozpoczyna się od:
public class RohwareActionBar extends FragmentActivity {...
RohwareFragmentMatlist jest zdefiniowany następująco:
public class RohwareFragmentMatlist extends ListFragment
implements LoaderManager.LoaderCallbacks<Cursor>{...
Fragment jest zdefiniowana w ten sposób:
<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>
to nie działa, aby uzyskać fragment via "getFragmentById" używając ListFragment?
Dziękujemy! Walczyłem z tym przez jakiś czas i byłem gotowy, aby rozpocząć zupełnie nowe podejście. Ta mała przekąska naprawiła mnie. –