okay, i solve the parameter passing by using named inner class instead of
anonymous inner class...
now how about my 1st question? (modifying the parent AlertDialog
message...)
2008/12/3 Romain Guy <[EMAIL PROTECTED]>
>
> Instead of using an anonymous inner class you should use a named inner
> class. Alternatively you can use this method:
>
> final int[] currentPosition = new int[] { position };
> // ...
> // in the inner class
> currentPosition[0] = theNewPosition;
>
> On Wed, Dec 3, 2008 at 4:19 PM, Lawrence Samantha <[EMAIL PROTECTED]>
> wrote:
> > So I have an AlertDialog, and I have one textview and 2 buttons on it.
> > 1. When that alert arise, would I be able to use the two button to update
> > the message shown on the AlertDialog? (modifying textview... )
> > 2. how do you pass variable from outer class to inner class and so forth?
> On
> > my code below, would I be able to read and modify value of
> current_position
> > from inside onClick() ? current_position is visible from onClick() only
> when
> > I change that to final... but then we're not supposed to change the
> variable
> > value again right?
> > public void onListItemClick(ListView parent, View v,int position, long
> id) {
> > int current_position = position
> > new AlertDialog.Builder(this)
> > .setTitle("This is the title")
> > .setMessage("Original Message")
> > .setPositiveButton("Previous", new
> > DialogInterface.OnClickListener() {
> > public void onClick(DialogInterface dialog, int
> > whichButton) {
> > /* want to setMessage again... */
> > }
> > })
> > .setNegativeButton("Next", new
> > DialogInterface.OnClickListener() {
> > public void onClick(DialogInterface dialog, int
> > whichButton) {
> > /* What to do... */
> > }
> > }).show();
> > }
> > --
> > Lawrence Samantha
> >
> > >
> >
>
>
>
> --
> Romain Guy
> www.curious-creature.org
>
> >
>
--
Lawrence Samantha
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---