Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand what you want, you could create a class with something like a <code>static Arraylist</code> to be appended each time an item is clicked. So create a class something like</p> <pre><code>public class Data class { static ArrayList&lt;String&gt; dataArray = new ArrayList&lt;String&gt;();; public Data() { // empty constructor but could be used if needed } </code></pre> <p>Then you can add different <code>getters/setters</code> or whatever you need here. When you click on an item you just call something like</p> <pre><code>Data.dataArray.add("stuff"); </code></pre> <p>then retrieve items in here in your next <code>Activity</code>.</p> <p>If that is too complicated or more than you need then you can just pass an <code>ArrayList</code> or whatever object you need through the <code>Intent</code></p> <p><a href="http://developer.android.com/reference/android/content/Intent.html" rel="nofollow">Intents</a></p> <p>Also, just a preference but since all of your <code>Button</code>s do the same thing, you can do away with initializing them and setting <code>listeners</code> on all of them. In xml just add </p> <pre><code>`android:onClick="someFunctionName"` </code></pre> <p>to each <code>Button</code> then use that function name</p> <pre><code>public void someFunctionName(View v) { switch(v.getId()) { // if one of the image buttons is pressed... Intent intent = new Intent(this, Listviewact.class); // pass ID of pressed button to listview-activity intent.putExtra("buttonId", v.getId()); startActivity(intent); break; // here you could place handling of other clicks if necessary... } </code></pre> <p>There is also no need for the <code>case</code> statements since they all do the same thing and you don't need <code>implements OnClickListener</code> in the <code>Activity</code> declaration</p>
    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.
 

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