Hi Justin,
I couldn't find any example from docs as per my needs and that you and
Trek are reffering to.
Yes I wanted to pass a listener to the static method for the list that
is in the Dialog. I managed to do it as follows :
As for common method :
*public AlertDialog createAlertDialog(String title, String[] items,
OnItemClickListener clickListener) {*
* ............*
* listView.setOnItemClickListener(clickListener);*
*}*
And In activity :
OnItemClickListener clickListener = *new* OnItemClickListener() {
*public **void* onItemClick(AdapterView<?> arg0, View v, *int* position, *
long* id) {
...........
}
alertDlg = *this*.createAlertDialog("Select Route", routes, clickListener);This
is how I have managed things. It can be helpful for anyone else. BTW, wht's
the best way to insert code in this forum.
Thanks to all.
On Wednesday, August 29, 2012 11:56:10 PM UTC+5:30, MagouyaWare wrote:
> Treking, Thanks
>> But pls read & understand my question proeprly.
>> I don't want to know how to handle events in the same dialog, it is how
>> to handle events in different Activity that is calling that AlertDialog.
>>
>
> The link Treking gave you gives you everything you need to know...
>
> Notice how all the examples in there are setting various click listeners
> on the dialog? Given what you've told us and the docs that Treking pointed
> you to, I would assume that you would want to add parameters to your static
> method that take a click listener of some sort... Each activity can have
> its own set of click listeners and they just pass them in when they need
> the dialog.
>
> Thanks,
> Justin Anderson
> MagouyaWare Developer
> http://sites.google.com/site/magouyaware
>
>
> On Wed, Aug 29, 2012 at 12:14 PM, tvdalia <[email protected]<javascript:>
> > wrote:
>
>>
>> Treking, Thanks
>> But pls read & understand my question proeprly.
>> I don't want to know how to handle events in the same dialog, it is how
>> to handle events in different Activity that is calling that AlertDialog.
>>
>> - Regards
>>
>>
>> On Wednesday, 29 August 2012 22:07:35 UTC+5:30, TreKing wrote:
>>
>>> On Wed, Aug 29, 2012 at 11:06 AM, tvdalia <[email protected]> wrote:
>>>
>>>> Now how do I handle click events for the ListView that is in
>>>> AlertDialog ??
>>>
>>>
>>> Review the Dialogs section in the documentation. It shows how to handle
>>> single and multiple choice selections in Diaogs.
>>>
>>> ------------------------------**------------------------------**
>>> ------------------------------**-------
>>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>>> transit tracking app for Android-powered devices
>>>
>>> --
>> 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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
--
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