Note that there are some explanatory texts on larger screens.

plurals
  1. POListView items not showing when running the android emulator
    primarykey
    data
    text
    <p>I am finding some problems when I try to display the text in a listview.</p> <p>The code in the ListView class is:</p> <pre><code> package org.practical.newsupdate; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class MenuView extends NewsfeedApp2Activity { public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); ListView menuList = (ListView) findViewById(R.id.menuview); String[] items = getResources().getStringArray(R.array.menu_array); ArrayAdapter&lt;String&gt; adapt = new ArrayAdapter&lt;String&gt;(this, R.layout.menuview, items); menuList.setAdapter(adapt); } } </code></pre> <p>The code for the main.xml is:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/ScreenTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="ScreenTitle" /&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/ic_launcher" /&gt; &lt;ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:src="@drawable/ic_launcher" /&gt; &lt;/RelativeLayout&gt; &lt;ListView android:id="@+id/MenuView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.88" android:visibility="visible"&gt; &lt;/ListView&gt; &lt;ImageView android:id="@+id/Picture" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>The code for the string.xml file is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;string name="hello"&gt;Hello World, NewsfeedApp2Activity!&lt;/string&gt; &lt;string name="app_name"&gt;NewsfeedApp2&lt;/string&gt; &lt;string name="ScreenTitle"&gt;ScreenTitle&lt;/string&gt; &lt;string-array name="menu_array"&gt; &lt;item&gt;NewsPage&lt;/item&gt; &lt;item&gt;Settings&lt;/item&gt; &lt;item&gt;Help&lt;/item&gt; &lt;item&gt;About&lt;/item&gt; &lt;/string-array&gt; &lt;/resources&gt; </code></pre> <p>The code for the main java file is:</p> <pre><code>package org.practical.newsupdate; import android.app.Activity; import android.os.Bundle; public class NewsfeedApp2Activity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } </code></pre> <p>and the code for the menuview.xml file is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/menuview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView"/&gt; </code></pre> <p>The androidmanifest.xml file has the following code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.practical.newsupdate" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="14" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:label="@string/app_name" android:name=".NewsfeedApp2Activity" &gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="MenuView"&gt;&lt;/activity&gt; &lt;activity android:name="About"&gt;&lt;/activity&gt; &lt;activity android:name="Help"&gt;&lt;/activity&gt; &lt;activity android:name="NewsPage"&gt;&lt;/activity&gt; &lt;activity android:name="Settings"&gt;&lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Can someone help me please?</p> <p>Thanks a lot</p>
    singulars
    1. This table or related slice is empty.
    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.
    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