Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing the data of the selected items to another activity - android
    primarykey
    data
    text
    <p>I have a menu <code>(fishcombovaluemeals),</code> and when the user select more than 1 item i want those items to appear in a list in another activity <em>(shopping cart)</em> ,i have tried alot but the data<br> never appears in the shopping cart ! what is wrong in the <code>onitemclick</code> !? , I have </p> <pre><code>fishcombovaluemeal.java RowItem.java CustomListViewAdapter.java </code></pre> <p>fishcombovaluemealsactivitycode: </p> <pre><code>package com.example.newlist; public class FishComboValueMeals extends Activity implements OnItemClickListener { ImageButton Ib2; public static final String[] titles = new String[] { " Fillet-O-Fish (Medium Value Meals) ", "Fillet-O-Fish (Large Value Meals) ", "Double Fillet-O-Fish (Medium Value Meals)", " Double Fillet-O-Fish (Large Value Meals) ", }; public static final String[] descriptions = new String[] { "Light, flaky filet of white fish topped with tangy tartar ", "Light, flaky filet of white fish topped with tangy tartar ", "2 patties of tender fish filet over a layer of cheese, ", " 2 patties of tender fish filet over a layer of " }; public static final Integer[] images = { R.drawable.imfc1, R.drawable.imfc2, R.drawable.imfc3, R.drawable.imfc4 }; public static final Double[] prices = { 20.0, 22.73, 24.77, 27.04 }; ListView listView; List&lt;RowItem&gt; rowItems; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_breakfast); rowItems = new ArrayList&lt;RowItem&gt;(); for (int i = 0; i &lt; titles.length; i++) { RowItem item = new RowItem (images[i], titles[i], descriptions[i], prices[i]); rowItems.add(item); } listView = (ListView) findViewById(R.id.list); CustomListViewAdapter adapter = new CustomListViewAdapter(this, R.layout.list_item, rowItems); listView.setAdapter(adapter); listView.setOnItemClickListener(this); Ib2 = (ImageButton) findViewById (R.id.Button02); Ib2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generatedmethod stub Intent openStartingPoint = new Intent (getApplicationContext(),ShoppingCart.class); startActivity (openStartingPoint); } });} @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent i = new Intent(getApplicationContext(), ShoppingCart.class); i.putExtra("EXTRA", "Item " + (position + 1) + ": " + rowItems.get(position)); startActivity(i); } } </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.
 

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