"Binary XML file line # 22: Error inflating class fragment" [closed]

1

I believe the error occurs due to lack of memory. I get the following exception. When I enter the application and minimize the same, then I enter several applications minimizing the ones that have been opened, I go back to the main application, it gives the error of "Application stopped".

  

java.lang.RuntimeException: Unable to start activity ComponentInfo {com.AndroidExplorer / com.AndroidExplorer.MainTab}: android.view.InflateException: Binary XML file line # 22: Error inflating class fragment       at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2121)       at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2146)       at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:3590)       at android.app.ActivityThread.access $ 800 (ActivityThread.java:140)       at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1244)       at android.os.Handler.dispatchMessage (Handler.java:99)       at android.os.Looper.loop (Looper.java:137)       at android.app.ActivityThread.main (ActivityThread.java:4947)       at java.lang.reflect.Method.invokeNative (Native Method)       at java.lang.reflect.Method.invoke (Method.java:511)       at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:1038)       at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:805)       at dalvik.system.NativeStart.main (Native Method)   Caused by: android.view.InflateException: Binary XML file line # 22: Error inflating class fragment       at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:710)       at android.view.LayoutInflater.rInflate (LayoutInflater.java:752)       at android.view.LayoutInflater.rInflate (LayoutInflater.java:760)       at android.view.LayoutInflater.inflate (LayoutInflater.java:495)       at android.view.LayoutInflater.inflate (LayoutInflater.java:397)       at android.view.LayoutInflater.inflate (LayoutInflater.java:353)       at com.android.internal.policy.impl.PhoneWindow.setContentView (PhoneWindow.java:318)       at android.app.Activity.setContentView (Activity.java:1925)       at com.AndroidExplorer.MainTab.onCreate (MainTab.java:78)       at android.app.Activity.performCreate (Activity.java:5207)       at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1094)       at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2085)       ... more   Caused by: java.lang.IllegalStateException: Fragment com.AndroidExplorer.ClientTab did not create a view.       at android.support.v4.app.FragmentActivity.onCreateView (FragmentActivity.java:295)       at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:682)       ... 23 more

    
asked by anonymous 01.06.2017 / 21:19

3 answers

0

Class: clientTab.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    System.out.println("teste antes de inflar layout");
    view = inflater.inflate(R.layout.clientetab, container, false);
    System.out.println("teste depois de inflar layout");

    // Define a imagem de fundo de acordo com a orientacao do dispositivo
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
        view.setBackgroundResource(R.drawable.fundocadastro);
    else
        view.setBackgroundResource(R.drawable.fundocadastro);

    instanciate();
    return view;
}
    
02.06.2017 / 19:05
0

clienttab.xml

<TextView android:text="Entrevistado:" android:id="@+id/txtEntrevistado" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>
<Spinner android:id="@+id/spinnerEntrevistado" android:layout_height="wrap_content" android:drawSelectorOnTop="true" android:layout_width="fill_parent"></Spinner>

<TextView android:id="@+id/txtUsuario" android:textSize="18dp" android:text="Usuário do imóvel:" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" > </TextView>
<EditText android:id="@+id/nomeUsuario" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/edittext_rounded_corners" android:inputType="textCapCharacters" android:maxLength="50" ><requestFocus></requestFocus> </EditText>

<TextView android:text="Tipo de Pessoa:" android:id="@+id/txtTipo_pessoa" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>
<Spinner android:id="@+id/spinnerTipoPessoaUsuario" android:layout_height="wrap_content" android:drawSelectorOnTop="true" android:layout_width="fill_parent"></Spinner>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout1">
    <TextView android:text="CPF:" android:id="@+id/txtCpfCnpjUsuario" android:minWidth="180dp" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>
    <TextView android:text="RG:" android:id="@+id/txtRgUsuario" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout2">
    <EditText android:id="@+id/cpfCnpjUsuario" android:minWidth="150dp" android:maxLength="18" android:background="@drawable/edittext_rounded_corners" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="number"></EditText>
    <EditText android:id="@+id/rgUsuario" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/edittext_rounded_corners" android:inputType="number" android:maxLength="13" ></EditText>
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout3">
    <TextView android:text="UF:" android:id="@+id/uf" android:minWidth="110dp" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>
    <TextView android:text="Sexo:" android:id="@+id/sexo" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout4">
    <EditText android:id="@+id/ufUsuario" android:minWidth="50dp" android:background="@drawable/edittext_rounded_corners" android:layout_height="wrap_content" android:drawSelectorOnTop="true" android:layout_width="wrap_content" android:maxLength="2" android:inputType="textCapCharacters"></EditText>
    <Spinner android:id="@+id/spinnerSexoUsuario" android:minWidth="200dp" android:layout_height="wrap_content" android:drawSelectorOnTop="true" android:layout_width="fill_parent"></Spinner>
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout5">
    <TextView android:text="Telefone:" android:id="@+id/txtTelefone" android:minWidth="150dp" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
    <TextView android:text="Celular:" android:id="@+id/txtCelular" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout6">
    <EditText android:id="@+id/foneUsuario" android:minWidth="150dp" android:background="@drawable/edittext_rounded_corners" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLength="14" android:inputType="phone"></EditText>
    <EditText android:id="@+id/celularUsuario" android:background="@drawable/edittext_rounded_corners" android:layout_width="fill_parent" android:layout_height="wrap_content" android:maxLength="14" android:inputType="phone"></EditText>
</LinearLayout>

<TextView android:text="E-mail:" android:id="@+id/txtEmailUsuario" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>
<EditText android:id="@+id/emailUsuario" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/edittext_rounded_corners" android:inputType="textEmailAddress" android:maxLength="50" ></EditText>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout7">
    <TextView android:text="Usuário é proprietário do imóvel:" android:id="@+id/txtUsuarioEProprietario" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout8">
    <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"    android:id="@+id/groupUsuarioEProprietario">
        <RadioButton android:text="Não" android:id="@+id/radioNao" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
        <RadioButton android:text="Sim" android:id="@+id/radioSim" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
    </RadioGroup>
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayoutTextoTipoEnderecoUsuario">
    <TextView android:text="Tipo de endereço do proprietário:" android:id="@+id/txtTipoEnderecoUsuario" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>

<LinearLayout     android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/linearLayoutTipoEnderecoUsuario">
    <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"    android:id="@+id/groupTipoEnderecoUsuario">
        <RadioButton android:text="Residencial" android:id="@+id/radioResidencial" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
        <RadioButton android:text="Comercial" android:id="@+id/radioComercial" android:layout_width="wrap_content" android:layout_height="wrap_content"></RadioButton>
    </RadioGroup>
</LinearLayout>

<LinearLayout     android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/linearLayoutUsuarioEProprietario">
</LinearLayout>

<TextView android:text="Responsável pelo Pagamento:" android:id="@+id/responsavelPagamento" android:textSize="15dp" android:textColor="@color/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content" ></TextView>
<Spinner android:layout_height="wrap_content" android:id="@+id/spinnerDefineResponsavel" android:drawSelectorOnTop="true" android:layout_width="fill_parent"></Spinner>

<LinearLayout     android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/linearLayoutResponsavelPagamento">
</LinearLayout>

<LinearLayout     android:orientation="horizontal" android:paddingTop="5dp" android:paddingRight="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayoutPeriodo">
    <TextView android:id="@+id/list_item_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:ellipsize="end" />
    <Button android:id="@+id/buttonSave" android:text="  OK  " android:textColor="@color/white" android:textSize="20dp" android:background="@drawable/button_rounded_corners" android:gravity="right" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>

    
02.06.2017 / 19:08
0

mainTab

             

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_weight="0"/>

    <fragment android:name="com.AndroidExplorer.ClienteTab"
        android:id="@+id/tabCliente"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:padding="2dp" 
        android:scrollbars="vertical"/>

    <fragment android:name="com.AndroidExplorer.ImovelTab"
        android:id="@+id/tabImovel"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:padding="2dp" 
        android:scrollbars="vertical"
        android:visibility="gone"/>

    <fragment android:name="com.AndroidExplorer.ServicosTab"
        android:id="@+id/tabServicos"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:padding="2dp" 
        android:scrollbars="vertical"
        android:visibility="gone"/>

    <fragment android:name="com.AndroidExplorer.AnormalidadeTab"
        android:id="@+id/tabAnormalidade"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:padding="2dp" 
        android:scrollbars="vertical"
        android:visibility="gone"/>

</LinearLayout>

    
02.06.2017 / 19:11