Hello Julian,

I think that you need to "attach" the button by name to the view.

Please refer to this thread for information which might be relevant.

http://groups.google.com/group/android-developers/browse_thread/thread/297073fb1c8579cc/df6767b1f70f86d6?lnk=gst&q=alexdonnini#df6767b1f70f86d6

Alex Donnini

On Nov 22, 10:30 pm, Julian <[EMAIL PROTECTED]> wrote:
> Ok.  I have a screen that is essentially a list with a dynamic number
> of items.  Each of these items when clicked needs to switch to the
> next screen and pass a variable over saying which was clicked.  I am
> trying to use intents to do this, but I am having some trouble.  Here
> is the chunk of code where I am trying to do this:
>
> for (int i = 0; i < count; i++){
>                 mi = db.getItem(i);
>                 //countText.setText(mi.title);
>                 items[i] = new TextView(this);
>                 items[i].setClickable(true);
>                 items[i].setText(mi.title);
>                 inteIntent = new Intent(this, MIScreen.class);
>                 inteIntent.putExtra("com.android.MIScreen.curIndex", i);
>                 items[i].setOnClickListener(new View.OnClickListener() {
>                  public void onClick(View v) {
>                         startActivity(inteIntent);
>                  }
>              });
>                 linearLayout.addView(items[i]);
>                 //items[i].setVisibility(1);
>         };
>
> What happens is every button I click just has the last intent settings
> so no matter which one I click the next screen shows that I clicked
> the last item.  I also tried to do this by using an array of intents.
> But that gives me an error when I click a button that I have not been
> able to figure out.
>
> So how should I be doing this?  Am I taking the wrong approach
> completely or am I just missing something small?
>
> Also, Im trying to use the wsimport tool to set up the Amazon API but
> am very unfamiliar with the Java tools and can't get wsimport to run
> on the command line at all.
>
> Thanks.
> -Julian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to