Note that there are some explanatory texts on larger screens.

plurals
  1. POI can put my intent into listview
    primarykey
    data
    text
    <p>I have checked that the intent I did pass through my new activity, however, I cant seem to place it into the listview created.</p> <p>I have derived my listview item, but it is in string. That is the problem I am facing, because i need to convert it into an ArrayList(). So I am kindda unsure whether the last sentence of the code is correct. </p> <pre><code>if (checkedItems != null){ for (int i=0; i&lt;checkedCount; i++) { if (checkedItems.valueAt(i)) { String item = lstMenu.getAdapter().getItem(checkedItems.keyAt(i)).toString(); </code></pre> <p>Below is the code for my new class where I am passing through my intent item from previous arraylist. Thanks in advance(:</p> <pre><code>package com.msyd.MenuProject; import java.util.ArrayList; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class Result extends Activity { ArrayList&lt;String&gt; items; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState) setContentView(R.layout.result); Intent intent = this.getIntent(); String selected = intent.getStringExtra("item"); } protected void onResume(){ super.onResume(); // Configure the listview items = new ArrayList&lt;String&gt;(); ListView lstitems = (ListView)this.findViewById(R.id.menuResult); //lstitems.addItem(selected); lstitems.setAdapter(new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,items)); } private void addItem(String item) { items.add(item); ListView lstitems = (ListView)this.findViewById(R.id.menuResult); ArrayAdapter&lt;String&gt; ad =(ArrayAdapter&lt;String&gt;)lstitems.getAdapter(); ad.notifyDataSetChanged();` } } </code></pre>
    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.
    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