Note that there are some explanatory texts on larger screens.

plurals
  1. POListView does not work
    primarykey
    data
    text
    <p>I'm trying to make a list view in a page that is liked form a button, but when I debug the application it shows only a black page with the name. I have 2 java one xml to de main page and one mainfest.xml</p> <p>page 1:</p> <pre><code>package tm.andrioid.com; import android.app.Activity; import android.app.Dialog; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.widget.Button; import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.widget.Button; public class indexActivity extends Activity { public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); Button bprodukter = (Button) findViewById(R.id.bprodukter); bprodukter.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { Intent i = new Intent(indexActivity.this, produkter.class); startActivity(i); } }); }`` } </code></pre> <p>page 2 java:</p> <pre><code> tm.andrioid.com; import android.app.Activity; import android.app.Dialog; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class produkter extends ListActivity { String classes[] = { "indexActivity", "Data", "Intim", "Hörlurar", "Prylar", "Mat", "Sex", "Sju"}; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter&lt;String&gt;(produkter.this, android.R.layout.simple_list_item_1)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id); String saker = classes[position]; try{ Class ourClass = Class.forName("tm.android.com." + saker); Intent ourIntent = new Intent(produkter.this, ourClass); startActivity(ourIntent); }catch(ClassNotFoundException e){ e.printStackTrace(); } } </code></pre> <p>}</p> <p>main xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tm.andrioid.com" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="15" /&gt; &lt;application android:icon="@drawable/tmm" android:label="@string/app_name" &gt; &lt;activity android:name=".splash" android:label="@string/app_name" &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=".indexActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="tm.android.com.INDEXACTIVITY" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".produkter" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="tm.android.com.PRODUKTER" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&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.
    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