Monday 15 July 2013

android - View not found for fragment when orientation changes -


I'm writing an application in C # xamarin for Android I This code is universal and should work on almost Android. So the question is valid for both Java and C #.

So I found this application, where my main activity is my piece manager, it is the place of the piece like this:

  Private Zero SelectItem (int position) {currentFragment = null ; Piece found frog = null; String tag = ""; Var logic = new bundle (); Switch (status) {case 0: //   

It all starts well and I can switch between pieces. But when I orientation changes would, if it crashes with the following error message:

 did not get a view of  id 0x7f080014 (PhotoWapp.PhotoWapp: id / content_frame) piece PictureFragment { b52cb3b0 # 1 id = 0x7f080014 picture} [fragment Manager] activity state: [fragment Manager] local activity b52f3060 state: [fragment Manager] mResumed = false mStopped = false mFinished = false [fragment Manager] mLoaders started = false [fragment Manager] m Changing Configuration = False [FRE Gment manager] mCurrentConfig = {1.0 310mcc260mnc en_US ldltr sw320dp W533dp h294dp 240dpi nrml long land finger QWERTY / V / V Tbol / VS 7} [fragment manager] B active fragment 52 F 3150:   < P> In my pieces, I have set  RetainInstance = true  and for some reason it can not get reference to the  resource.ID.content_frame . What should I do?  

The layout, where Resource.Id.content_frame is referenced: Resource.Layout.Main . And looks like:

   & Lt ;! - Navigation Drawer - & gt; Android: Android: Leaut_graviti = "Start" Android: ChoiceMode = "Singlechoice" android: divider = "@ android: Android: Android: Android: Android: Android: colored / transparent" Android: dividerHeight = "0dp" android: background = " # 111 "/> & Lt; /android.support.v4.widget.DrawerLayout>    

I think you use Resource.Layout.nameofxmlresource instead of Resource.Id should do .. .

No comments:

Post a Comment