Note that there are some explanatory texts on larger screens.

plurals
  1. POViewStub NullPointerException
    primarykey
    data
    text
    <p>I have a problem with the view stub.</p> <p>This is the ViewStub in my java file</p> <pre><code>ViewStub stub = (ViewStub) findViewById(R.id.stub1); ArrayAdapter&lt;String&gt; content=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,files); View inflated=stub.inflate(); ListView people=(ListView)inflated.findViewById(R.id.friends); people.setAdapter(content); </code></pre> <p>This is the xml where I initialize the Viewstub</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;merge xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id = "@+id/linear_details" &gt; &lt;include layout="@layout/home_back_next_bar" /&gt; &lt;ViewStub android:id="@+id/stub1" android:inflatedId="@+id/showlayout" android:layout="@layout/layout1" android:layout_width="fill_parent" android:layout_height="wrap_content"/&gt; &lt;/LinearLayout&gt; &lt;/merge&gt; </code></pre> <p>my layout file inflated in the view stub is as follows:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/friends" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; </code></pre> <p>This code gives me a NullPointerException when creating instance of the listview to fill it. Any Ideas what causes this problem and how to solve.</p> <p>Thanks alot in advance</p> <p>Error in Log cat: <img src="https://i.stack.imgur.com/y9CbG.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    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