Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I use support library v4 and Sherlock Actionbar.</p> <p>After some tries with and without BackStack and simplifying the layout of step fragments, I finaly found the reason for the exception.</p> <p>I use a fragment (selction spinner) in my first step fragmen (see XML-layout)</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/lbl_report_type" style="@style/wd_field_label" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="@string/rpz_lbl_report_type" /&gt; &lt;fragment android:id="@+id/frag_report_type_spinner" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/lbl_report_type" class="de.webducer.android.ReportTypeSelectorSpinnerFragment" /&gt; &lt;TextView android:id="@+id/lbl_report_name" style="@style/wd_field_label" android:layout_alignParentLeft="true" android:layout_below="@+id/frag_report_type_spinner" android:text="@string/rpz_lbl_report_name" /&gt; &lt;EditText android:id="@+id/report_name" style="@style/wd_text_edit_pref" android:layout_alignParentLeft="true" android:layout_below="@+id/lbl_report_name" android:hint="@string/rpz_hint_report_name" /&gt; &lt;TextView android:id="@+id/lbl_report_comment" style="@style/wd_field_label" android:layout_alignParentLeft="true" android:layout_below="@+id/report_name" android:text="@string/rpz_lbl_report_comment" /&gt; &lt;EditText android:id="@+id/report_comment" style="@style/wd_text_multi_edit_pref" android:layout_alignParentLeft="true" android:layout_below="@+id/lbl_report_comment" android:hint="@string/rpz_hint_report_comment" /&gt; &lt;TextView android:id="@+id/lbl_active" style="@style/wd_field_label" android:layout_alignParentLeft="true" android:layout_below="@+id/report_comment" android:text="@string/lbl_active" /&gt; &lt;CheckBox android:id="@+id/report_type_active" style="@style/wd_text_edit_pref" android:layout_alignParentLeft="true" android:layout_below="@+id/lbl_active" android:checked="true" android:text="@string/rpz_hint_report_type_active" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Ithis <strong>inner</strong> fragment produced the exception because the <strong>outer</strong> fragment tries in onCreateView to inflate the <strong>inner</strong> fragment. And this one is already in FragmentManager with the given ID.</p> <p>My solution is now to destroy the <strong>inner</strong> fragment bevore replace with new one or before call from back stack.</p> <pre><code>private void runPrevious(View view) { switch (_CurrentPage) { case ReportTypeAndName: // Umstellung des Typs _CurrentPage = ReportWizardPage.None; this.finish(); break; case ReportSelect: if (getSupportFragmentManager().findFragmentById(R.id.frag_report_type_spinner) != null) { getSupportFragmentManager().beginTransaction() .remove(getSupportFragmentManager().findFragmentById(R.id.frag_report_type_spinner)).commit(); } getSupportFragmentManager().popBackStack(); // Umstellung des Typs _CurrentPage = ReportWizardPage.ReportTypeAndName; break; case ReportPreview: _CurrentPage = ReportWizardPage.ReportSelect; break; default: break; } setButtonState(); } </code></pre> <p>I hope, this help othesr, who tries to implement wizards.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload