On 4/6/2010 6:17 PM, raqz wrote:
I am trying to record the position into the array a[]. And everytime
somebody clicks some row in the list, the i value needs to be
incremented. Anything wrong with that? Please suggest some other
alternative if you have anything in mind.

You need a growing data structure like Vector for this and then append the values.

Vector positions = new Vector();
positions.add(position);

The above code isn't complete, left as an exercise to the reader ;-)

You defined a zero size array and trying to access it will crash.

Michael


On Apr 6, 12:09 pm, Michael Rueger<[email protected]>  wrote:
On 4/6/2010 6:03 PM, raqz wrote:

Hi, I am trying to record the selection made by the user in the array.
But when I run the app, it crashes the moment I click something.
Please let me know what could be done for this.

public class ListViewExample extends ListActivity
{
    public int a[];
    public int i=0;

...

            a[i++]=position;

That's probably the culprit.
What are you trying to do here?

Michael


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to