Note that there are some explanatory texts on larger screens.

plurals
  1. POOccasionally gets null from (View).findViewByID
    primarykey
    data
    text
    <p>I hava a Android app @ Android Market. And Im keep getting some crash reports that claims that some users get a NullPointerException.</p> <p>I've located the code that seems to be causing this problem.</p> <p>It's in a ArrayAdapters getView method. </p> <pre><code>if (v == null) { LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.subcatategory_row, null); holder = new ViewHolder(); v.setTag(holder); } else { holder=(ViewHolder)v.getTag(); if(holder == null){ holder = new ViewHolder(); } } TextView tl = (TextView) v.findViewById(R.id.label); tl.setTextAppearance(getContext(), R.style.styleA); </code></pre> <p>The last line in this snippet seems to be causing the crash. However I've never experienced it, and I've been testing it on several devices. </p> <p>Help would be greatly appreciated!!</p> <p>EDIT:</p> <p>subcategory_row.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/row_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="0dip" android:background="@drawable/background" android:weightSum="80"&gt; &lt;TextView android:id="@+id/label" android:layout_weight="9" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_marginRight="6dip" android:gravity="center_vertical|center" android:text="C.r" android:textSize="12sp" android:textColor="@color/default_textcolor" /&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="53" android:layout_height="fill_parent"&gt; &lt;TextView android:id="@+id/text_bb" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:layout_marginLeft="4dip" android:gravity="bottom" android:textSize="13sp" android:textColor="@color/default_textcolor" android:ellipsize="end" android:singleLine="true"/&gt; &lt;TextView android:id="@+id/text_ba" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:layout_marginLeft="4dip" android:gravity="top" android:textSize="13sp" android:textColor="@color/default_textcolor" android:ellipsize="end" android:singleLine="true"/&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="8" android:layout_height="fill_parent" &gt; &lt;TextView android:id="@+id/text_a" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="bottom|right" android:textSize="13sp" android:text="0" android:textColor="@color/default_textcolor" /&gt; &lt;TextView android:id="@+id/text_b" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="top|right" android:textSize="19sp" android:text="0" android:textColor="@color/default_textcolor" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="0dip" android:layout_height="wrap_content" android:layout_gravity="center_vertical|right" android:layout_weight="10" android:orientation="vertical" android:paddingLeft="10dp" &gt; &lt;ImageView android:id="@+id/arrow" android:layout_width="wrap_content" android:layout_height="40dp" android:paddingLeft="-10dip" android:paddingRight="10dip" android:src="@drawable/arrow" android:visibility="visible" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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