Runtimeexception (Android)

Asked

Viewed 47 times

1

I want to put the atendenteBalaoProdutoNome on the side of AtendenteBalaoProdutoValor, thus:

inserir a descrição da imagem aqui

to do this, I tried this:

attendant.xml

<?xml version="1.0" encoding="utf-8"?>
<merge
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

<RelativeLayout
style="@style/layoutAtendenteBalao"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+atendente/rltAtendenteBalao">

<TextView
    style="@style/campoAtendenteBalaoTexto"
    android:id="@+atendente/txtTexto"/>

<RelativeLayout
    style="@style/atendenteBalaoVO"
    android:layout_width="match_parent"
    android:id="@+atendente/rltAtendenteBalaoVO">"

    <TextView
        style="@style/atendenteBalaoVOTexto1"
        android:id="@+atendente/txtAtendenteBalaoVOTexto1"/>

    <LinearLayout
        style="@style/atendenteBalaoVOTextoQuantidadeTexto2">"

        <EditText
            style="@style/atendenteBalaoVOQuantidade"
            android:id="@+atendente/txtAtendenteBalaoVOQuantidade"/>

        <TextView
            style="@style/atendenteBalaoVOTexto2"
            android:id="@+atendente/txtAtendenteBalaoVOTexto2"/>

    </LinearLayout>

    <Button
        style="@style/atendenteBalaoVOMais"
        android:id="@+atendente/btnAtendenteBalaoVOMais"/>

    <Button
        style="@style/atendenteBalaoVOMenos"
        android:id="@+atendente/btnAtendenteBalaoVOMenos"/>

</RelativeLayout>

<RelativeLayout
    style="@style/atendenteBalaoProduto"
    android:id="@+atendente/lnrProduto">

    <TextView
        style="@style/atendenteBalaoProdutoNome"
        android:id="@+atendente/txtProdutoNome"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@+id/txtProdutoValor"/>

    <TextView
        style="@style/atendenteBalaoProdutoValor"
        android:id="@+atendente/txtProdutoValor"
        android:layout_alignParentRight="true"/>

    <LinearLayout
        style="@style/atendenteBalaoProduto2"
        android:id="@+atendente/lnrProdutoQuantidade"
        android:focusableInTouchMode="true">

        <TextView
            style="@style/atendenteBalaoProdutoRotuloQuantidade"
            android:id="@+atendente/txtProdutoQuantidadeRotulo" />

        <EditText
            style="@style/atendenteBalaoProdutoQuantidade"
            android:id="@+atendente/txtProdutoQuantidade"
            android:inputType="numberDecimal"
            android:digits="0123456789,." 
            android:imeOptions="actionDone"/>

        <TextView
            style="@style/atendenteBalaoProdutoUnidade"
            android:id="@+atendente/txtProdutoUnidade"/>

        <Button
            style="@style/atendenteBalaoProdutoMenosMais"
            android:id="@+atendente/btnQtdeMenos"
            android:text="-" />

        <Button
            style="@style/atendenteBalaoProdutoMenosMais"
            android:id="@+atendente/btnQtdeMais"
            android:text="+" />

    </LinearLayout>

</RelativeLayout>    

Styles.xml

<style name="layoutAtendente">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">300px</item>
    <item name="android:layout_alignParentRight">true</item>
    <item name="android:layout_alignParentBottom">true</item>
</style>

<style name="layoutAtendenteBalao">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">97px</item>
<!--<item name="android:layout_alignParentRight">true</item>
    <item name="android:layout_alignParentBottom">true</item>
    <item name="android:layout_marginRight">104px</item>-->
    <item name="android:layout_marginBottom">83px</item>
    <item name="android:background">@drawable/borda_balao</item>
<!--<item name="android:paddingLeft">3dp</item>
    <item name="android:paddingRight">3dp</item>-->
    <item name="android:paddingTop">2dp</item>
<!--<item name="android:paddingBottom">2dp</item>-->
</style>

<style name="campoAtendenteBalaoTexto">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">match_parent</item>
    <item name="android:gravity">center</item>
    <item name="android:textSize">8dp</item>
    <item name="android:textColor">@color/black</item>
    <item name="android:layout_marginBottom">9dp</item>
</style>

<style name="atendenteBalaoProduto">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_alignParentTop">true</item>
    <item name="android:layout_alignParentLeft">true</item>
    <item name="android:orientation">vertical</item>
    <item name="android:visibility">invisible</item>
</style>

<style name="atendenteBalaoProdutoNome">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textSize">7dp</item>
    <item name="android:textColor">@color/black</item>
    <item name="android:textStyle">bold</item>
    <item name="android:layout_marginTop">13dp</item>
    <item name="android:layout_marginLeft">5dp</item>
</style>

<style name="atendenteBalaoProdutoValor">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textSize">7dp</item>
    <item name="android:textColor">@color/black</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="atendenteBalaoProdutoRotuloQuantidade">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_marginRight">5dp</item>
    <item name="android:textSize">7dp</item>
    <item name="android:textColor">@color/black</item>
    <item name="android:text">Quantidade</item>
 </style>

<style name="atendenteBalaoProdutoQuantidade">
    <item name="android:layout_width">40dp</item>
    <item name="android:layout_height">30dp</item>
    <item name="android:layout_marginRight">10dp</item>
    <item name="android:padding">3dp</item>
    <item name="android:singleLine">true</item>
    <item name="android:textSize">9dp</item>
    <item name="android:textColor">#ff000000</item>
    <item name="android:digits">1234567890</item>
    <item name="android:maxLength">5</item>
    <item name="android:text">999</item>
</style>

<style name="atendenteBalaoProdutoUnidade">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_marginRight">5dp</item>
    <item name="android:textSize">7dp</item>
    <item name="android:textColor">@color/black</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="atendenteBalaoProdutoMenosMais">
    <item name="android:layout_width">40px</item>
    <item name="android:layout_height">30dp</item>
    <item name="android:layout_marginRight">3dp</item>
    <item name="android:padding">2dp</item>
    <item name="android:textSize">8dp</item>
    <item name="android:textColor">#ff000000</item>   
</style>

But you showed me the following log:

05-13 16:22:39.469: E/AndroidRuntime(21065): FATAL EXCEPTION: main 
05-13 16:22:39.469: E/AndroidRuntime(21065): Process: br.com.xxxx.xxxx.activity, PID: 21065 
05-13 16:22:39.469: E/AndroidRuntime(21065): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{br.com.xxxx.xxxx.activity/br.com.xxxx.xxxx.activity.ACTAtendimento}: android.view.InflateException: 
Binary XML file line #195: Error inflating class br.com.xxxx.xxxx.controls.Atendente`

When I debug on line 195 of ACTAtendimento:

inserir a descrição da imagem aqui

  • Jean, could include the xml of the layout Activity ACTAtendimento? In addition, it could include the class code Atendimento?

  • @Wakim these codes are too big to be included here. Also there is no class Atendimento, the one that has is the Atendente, would be this?

  • Jean, you can replace the code you have in the question, because it doesn’t help much. That, I confuse the mome, but the most important is the class Atendente and the layout of Activity ACTAtendimento.

1 answer

0


I had forgotten to change the type of the object in Atendente.java Stayed like this:

RelariveLayout rltProduto           = (RelativeLayout) findViewById(R.atendente.lnrProduto);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.