Re: [android-developers] Re: Alert Dialog Box

2012-08-11 Thread Meena Rengarajan
Thanku :)

On Sat, Aug 11, 2012 at 3:38 AM, bob b...@coolfone.comze.com wrote:

  final WifiManager wifiManager = (WifiManager) this

   .getSystemService(Context.WIFI_SERVICE);


  AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(Enable Wifi?)

   .setCancelable(false)

   .setPositiveButton(Yes,

new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int id) {

 wifiManager.setWifiEnabled(true);

}

})

   .setNegativeButton(No, new DialogInterface.OnClickListener() {

   public void onClick(DialogInterface dialog, int id) {

dialog.cancel();

finish();

   }

   });

  AlertDialog alertDialog = builder.create();

  alertDialog.show();

 On Friday, August 10, 2012 12:48:11 AM UTC-5, Meena Rengarajan wrote:

 How to Enable Wifi automatically in Android 2.2 in an alert box ? If i
 click Yes button then it should be enable and if i click no then
 application must be closed. Can anyone tell me this how should i do ?

  --
 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
 android-developers+unsubscr...@googlegroups.com
 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Alert Dialog Box

2012-08-10 Thread bob
 

 final WifiManager wifiManager = (WifiManager) this

  .getSystemService(Context.WIFI_SERVICE);


 AlertDialog.Builder builder = new AlertDialog.Builder(this);

 builder.setMessage(Enable Wifi?)

  .setCancelable(false)

  .setPositiveButton(Yes,

   new DialogInterface.OnClickListener() {

   public void onClick(DialogInterface dialog, int id) {

wifiManager.setWifiEnabled(true);

   }

   })

  .setNegativeButton(No, new DialogInterface.OnClickListener() {

  public void onClick(DialogInterface dialog, int id) {

   dialog.cancel();

   finish();

  }

  });

 AlertDialog alertDialog = builder.create();

 alertDialog.show();

On Friday, August 10, 2012 12:48:11 AM UTC-5, Meena Rengarajan wrote:

 How to Enable Wifi automatically in Android 2.2 in an alert box ? If i 
 click Yes button then it should be enable and if i click no then 
 application must be closed. Can anyone tell me this how should i do ?


-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: alert dialog with refreshable listview

2011-07-15 Thread kamiseq
so my final solution is

A. create custom adapter based on CursorAdapter (or BaseAdapter)
B. create custom row layout in xml and inflate it in adapter
C. create AlertDialog and setItem(new CharSeq[0], null) - this will
create default list with default look and feel, without this code
listView is not initialized
D. in onPrepareDialog get ListView from dialog and set custom adapter
with new data, add click event handler which is called with item
position and id of the row(if cursor adapter was used)

when I tried creating custom dialog with scroll view and list view I
had to additionally setup layout_width and height for the dialog AFTER
it was created (so in onPrepareDialog callback) if not dialog was
quite small.

PK

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: alert dialog with refreshable listview

2011-07-15 Thread Kostya Vasilyev

Not sure why you need step C.

Other than that, yes, AlertDialog has a getListView method, which you 
can call from onPrepareDialog, get the adapter, and tell it about the 
new data.


-- Kostya

15.07.2011 13:44, kamiseq пишет:

so my final solution is

A. create custom adapter based on CursorAdapter (or BaseAdapter)
B. create custom row layout in xml and inflate it in adapter
C. create AlertDialog and setItem(new CharSeq[0], null) - this will
create default list with default look and feel, without this code
listView is not initialized
D. in onPrepareDialog get ListView from dialog and set custom adapter
with new data, add click event handler which is called with item
position and id of the row(if cursor adapter was used)

when I tried creating custom dialog with scroll view and list view I
had to additionally setup layout_width and height for the dialog AFTER
it was created (so in onPrepareDialog callback) if not dialog was
quite small.

PK



--
Kostya Vasilyev

--
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: alert dialog with refreshable listview

2011-07-14 Thread Kostya Vasilyev
The mapping presumably exists in your data structures - where you can 
get an item by its position (available via 
DialogInterface.OnClickListener), then look up its id.


-- Kostya

14.07.2011 1:33, kamiseq пишет:

OK but still I cannot use the default adapter as I need map selected
item index to entry id!



--
Kostya Vasilyev

--
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: alert dialog with refreshable listview

2011-07-14 Thread kamiseq
heh, ok, but first you need to get array(list) of Element objects from
db with ids) then rewrite it to array of CharSequence and when user
clicks on item search for Eleement object in first list. this
should be far easier ;]

thanks for answers!

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: alert dialog with refreshable listview

2011-07-14 Thread Kostya Vasilyev

Use your own adapter then:

AlertDialog.Builder.setAdapter

And get the elements directly from a Cursor, or from any other data 
structure.


-- Kostya

14.07.2011 15:25, kamiseq пишет:

heh, ok, but first you need to get array(list) of Element objects from
db with ids) then rewrite it to array of CharSequence and when user
clicks on item search for Eleement object in first list. this
should be far easier ;]

thanks for answers!



--
Kostya Vasilyev

--
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: alert dialog with refreshable listview

2011-07-14 Thread kamiseq
ok, that could be perferct but maybe I ll say something stupid.

If I write my custom adapter I have to pass row layout to it? right or
can I somhow avoid that and use the one builder is using???

;-)

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: alert dialog with refreshable listview

2011-07-14 Thread Kostya Vasilyev
Your adapter (any adapter, really) should have a getView method, where 
you can inflate any layout from a resource.


14.07.2011 19:28, kamiseq пишет:

ok, that could be perferct but maybe I ll say something stupid.

If I write my custom adapter I have to pass row layout to it? right or
can I somhow avoid that and use the one builder is using???

;-)



--
Kostya Vasilyev

--
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: alert dialog with refreshable listview

2011-07-14 Thread kamiseq
ok I just thought there is another way, thanks!

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: alert dialog with refreshable listview

2011-07-13 Thread kamiseq
I think this is the stupidest thing in android there should be a model
that could be easily invalidated :/

thanks Ill use that for now

any other tips highly appreciated ;]

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: alert dialog with refreshable listview

2011-07-13 Thread kamiseq
OK but still I cannot use the default adapter as I need map selected
item index to entry id!

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Aaron Buckner
Can anyone give me any ideas here this is really frustrating I can't think 
of any other way to implement this and I have to assume the user would mess 
up and need to reach this dialog again.

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Justin Anderson
What method is this code in?

On Mon, Feb 21, 2011 at 11:58 AM, Aaron Buckner nagm...@gmail.com wrote:

 Can anyone give me any ideas here this is really frustrating I can't think
 of any other way to implement this and I have to assume the user would mess
 up and need to reach this dialog again.

  --
 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
 android-developers+unsubscr...@googlegroups.com
 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Aaron Buckner
Its all in the main method I have, part of the onCreate. Should I put it 
outside the onCreate section?

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Sunil Lakhiyani
please refer this link

http://www.androidpeople.com/android-alertdialog-example/
http://www.androidpeople.com/android-alertdialog-example/ and

http://www.tutorialforandroid.com/2009/01/displaying-alertdialog-in-android.html

http://www.tutorialforandroid.com/2009/01/displaying-alertdialog-in-android.htmlthis
will help you out.




On Mon, Feb 21, 2011 at 11:18 AM, Aaron Buckner nagm...@gmail.com wrote:

 all in the main method I have, part of the onCreate. Should I put it
 outside the onCreate section?

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Aaron Buckner
Ok, well those helped out to a point... they helped me narrow down the line 
of code that is causing the problem...

alert.setView(input);

If I comment it out the dialog opens as much as I need it to, of course that 
also prevents the user from being able to enter any input in...

which is called initiated here:
final EditText input = new EditText(this);

and called here:
String value = input.getText().toString();

All of which is shown in the original code block for full context, Is there 
something I have to do in order to get the view to remove itself or recycle?

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Sunil Lakhiyani
http://stackoverflow.com/questions/3968170/android-prompt-users-input-using-a-dialog



On Mon, Feb 21, 2011 at 12:11 PM, Aaron Buckner nagm...@gmail.com wrote:

 Ok, well those helped out to a point... they helped me narrow down the line
 of code that is causing the problem...

 alert.setView(input);

 If I comment it out the dialog opens as much as I need it to, of course
 that also prevents the user from being able to enter any input in...

 which is called initiated here:
 final EditText input = new EditText(this);



-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Justin Anderson
Whenever I create dialogs, I use onCreateDialog() and let the Activity
handle creation...
http://developer.android.com/reference/android/app/Activity.html#onCreateDialog%28int,%20android.os.Bundle%29

To display the dialog use showDialog()...
http://developer.android.com/reference/android/app/Activity.html#showDialog%28int%29

This lets the activity handle creating your dialog (and caches it)... Then
you can show it as many times as you want without a problem.

On Mon, Feb 21, 2011 at 1:11 PM, Aaron Buckner nagm...@gmail.com wrote:

 Ok, well those helped out to a point... they helped me narrow down the line
 of code that is causing the problem...

 alert.setView(input);

 If I comment it out the dialog opens as much as I need it to, of course
 that also prevents the user from being able to enter any input in...

 which is called initiated here:
 final EditText input = new EditText(this);

 and called here:
 String value = input.getText().toString();

 All of which is shown in the original code block for full context, Is there
 something I have to do in order to get the view to remove itself or recycle?

 --
 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
 android-developers+unsubscr...@googlegroups.com
 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Aaron Buckner
I follow the concept but I always have problems converting dev.android.com 
documentation to real world use... can you show me some code to create an 
activity managed dialog or point me to an online example. I'm looking around 
and not finding very many examples (none that seem to work)... Thanks to 
everyone that has looked at this and helped so far.

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Alert Dialog - Specified child already has a parent - on 2nd attempt

2011-02-21 Thread Dianne Hackborn
API demos has a sample of creating a bunch of different alert dialogs as
managed dialogs:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.html

On Mon, Feb 21, 2011 at 7:38 PM, Aaron Buckner nagm...@gmail.com wrote:

 I follow the concept but I always have problems converting 
 dev.android.comdocumentation to real world use... can you show me some code 
 to create an
 activity managed dialog or point me to an online example. I'm looking around
 and not finding very many examples (none that seem to work)... Thanks to
 everyone that has looked at this and helped so far.

  --
 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
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Alert Dialog to display across activities?

2010-03-01 Thread Sam
Basically I'm trying to get a popup notification that will work
independently of the Activity underneath it. Basically I want a
message to be on top of an Activity and stays there even if a timer
kicks in a the Activity transitions to another.

On Feb 26, 9:11 am, TreKing treking...@gmail.com wrote:
 On Thu, Feb 25, 2010 at 11:10 PM, Sam samm...@gmail.com wrote:
  Does anyone know if it's possible to get a Dialog box to display
  between activities?

 What are you trying to achieve by doing this? Maybe there's another / better
 way ...

 -
 TreKing - Chicago transit tracking app for Android-powered 
 deviceshttp://sites.google.com/site/rezmobileapps/treking

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Alert Dialog to display across activities?

2010-03-01 Thread TreKing
On Mon, Mar 1, 2010 at 10:30 AM, Sam samm...@gmail.com wrote:

 Basically I'm trying to get a popup notification that will work
 independently of the Activity underneath it. Basically I want a
 message to be on top of an Activity and stays there even if a timer
 kicks in a the Activity transitions to another.


Well, you could use a Toast message, that will stay up regardless of what's
going on, but that's timed and will go away eventually. I highly doubt that
you will be able to do this otherwise.

And why do you want to do this anyway? There's probably a better strategy as
far as usability is concerned.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Alert Dialog

2010-02-11 Thread Nithin
First create a dialog, with no header
requestWindowFeature(Window.FEATURE_NO_TITLE)

Then create the layout in whichever way you want and add the layout to
dialog
addContentView()

On Feb 11, 4:36 pm, Sasikumar.S sasikumar.it1...@gmail.com wrote:
 Hi,

 Pls see the below link  tell how to create a dialog box like that?

 http://img.skitch.com/20090708-t6pc3h3jfhrnxj38sr6wi7i9k3.jpg

 http://img.skitch.com/20090708-t6pc3h3jfhrnxj38sr6wi7i9k3.jpgThere Dialog
 Test is Heading. It should be displayed in Bold.
 You clicked button index 2 is text. It should be in ordinary font.
 No lines between Heading  Text.
 Heading  Text should be in center.

 can any one tell about this?..

 --
 Thanks  Regards
 Sasikumar.S

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Alert Dialog

2010-02-11 Thread TreKing
On Thu, Feb 11, 2010 at 7:24 AM, Nithin nithin.war...@gmail.com wrote:

 First create a dialog, with no header
 requestWindowFeature(Window.FEATURE_NO_TITLE)


You don't even have to do that. Just don't set a title on your dialog and it
won't show up.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Alert Dialog font issue for Network location provider

2009-12-23 Thread dvp
Any suggestion to control the font in Alert dialog?

On Dec 19, 4:26 pm, Prasad Duggineni prasad.duggin...@gmail.com
wrote:
 We see the bigger font for Alert dialog agree and disagree buttons when the
 network provider is selected from the location settings menu. Any
 suggestions or pointers to resolve this issue. Dialog is controlled by
 Network location.apk which is not open source.

 Attached the screen shot as well.

  device.png
 16KViewDownload

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Alert dialog in Android-SDK-1.1-Release 1

2009-03-27 Thread tauntz

Are you using dialog titles?

Somebody from the Android team decided that dialog titles can't be
longer than 2 lines anymore. That means they can not be longer than 2
words in some cases/languages. And no, nobody has explained the
reasoning behind this move (other than - why are you using so long
titles? don't use them!). It's also not documented at
http://d.android.com/sdk/android-1.1.html why changes like this are
not listed? Ask someone who knows :)

Tauno

On Fri, Mar 27, 2009 at 1:54 PM, Zhubham sahilz...@gmail.com wrote:

 Hi all,

 Alert dialogs which were properly displaying the full text (around 15
 words) in SDK-1.0 , are trimming down the text to around 5 words in
 SDK-1.1.

 eg.

 SDK1.0 = Welcome. This is an android based application. SDK used is
 1.1-Release 1.

 SDK1.1 =  Welcome. This is an android based app...

 Can someone help me with this??

 Thanks in advance.

 Regards,
 Zhubham.
 


--~--~-~--~~~---~--~~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Alert dialog in Android-SDK-1.1-Release 1

2009-03-27 Thread Sahil Arora
Yes, i m using dialog titles. So going ahead do i need to replace my alert
dialog with something else?? What is the suitable replacement u recommend??
Thanks.


On Fri, Mar 27, 2009 at 5:41 AM, tauntz tau...@gmail.com wrote:


 Are you using dialog titles?

 Somebody from the Android team decided that dialog titles can't be
 longer than 2 lines anymore. That means they can not be longer than 2
 words in some cases/languages. And no, nobody has explained the
 reasoning behind this move (other than - why are you using so long
 titles? don't use them!). It's also not documented at
 http://d.android.com/sdk/android-1.1.html why changes like this are
 not listed? Ask someone who knows :)

 Tauno

 On Fri, Mar 27, 2009 at 1:54 PM, Zhubham sahilz...@gmail.com wrote:
 
  Hi all,
 
  Alert dialogs which were properly displaying the full text (around 15
  words) in SDK-1.0 , are trimming down the text to around 5 words in
  SDK-1.1.
 
  eg.
 
  SDK1.0 = Welcome. This is an android based application. SDK used is
  1.1-Release 1.
 
  SDK1.1 =  Welcome. This is an android based app...
 
  Can someone help me with this??
 
  Thanks in advance.
 
  Regards,
  Zhubham.
  
 

 


--~--~-~--~~~---~--~~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Alert dialog in Android-SDK-1.1-Release 1

2009-03-27 Thread tauntz

If you are actually using your dialog title for the title and it won't
fit, then I suggest you file a bug report
(http://code.google.com/p/android/issues/ ) since for me this is a bug
(eg dialog titles can be only 2 lines.. really - that's a problem in
some languages where common words are way longer than in english). If
enough people have this issue that they can't use the dialog title for
titles anymore, then this might be changed in a future release.

If you are using it for showing general messages, then don't use the
title for this, use setMessage(message) (in AlertDialog.Builder or
AlertDialog).


Tauno




On Fri, Mar 27, 2009 at 2:52 PM, Sahil Arora sahilz...@gmail.com wrote:
 Yes, i m using dialog titles. So going ahead do i need to replace my alert
 dialog with something else?? What is the suitable replacement u recommend??
 Thanks.


 On Fri, Mar 27, 2009 at 5:41 AM, tauntz tau...@gmail.com wrote:

 Are you using dialog titles?

 Somebody from the Android team decided that dialog titles can't be
 longer than 2 lines anymore. That means they can not be longer than 2
 words in some cases/languages. And no, nobody has explained the
 reasoning behind this move (other than - why are you using so long
 titles? don't use them!). It's also not documented at
 http://d.android.com/sdk/android-1.1.html why changes like this are
 not listed? Ask someone who knows :)

 Tauno

 On Fri, Mar 27, 2009 at 1:54 PM, Zhubham sahilz...@gmail.com wrote:
 
  Hi all,
 
  Alert dialogs which were properly displaying the full text (around 15
  words) in SDK-1.0 , are trimming down the text to around 5 words in
  SDK-1.1.
 
  eg.
 
  SDK1.0 = Welcome. This is an android based application. SDK used is
  1.1-Release 1.
 
  SDK1.1 =  Welcome. This is an android based app...
 
  Can someone help me with this??
 
  Thanks in advance.
 
  Regards,
  Zhubham.
  
 




 


--~--~-~--~~~---~--~~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Alert dialog in Android-SDK-1.1-Release 1

2009-03-27 Thread Sahil Arora
Hi man,
Thanks for ur quick reply.. Yes i m actually displaying a message. So i will
try it out with setMessage function and revert back.

Thanks again.

On Fri, Mar 27, 2009 at 6:04 AM, tauntz tau...@gmail.com wrote:


 If you are actually using your dialog title for the title and it won't
 fit, then I suggest you file a bug report
 (http://code.google.com/p/android/issues/ ) since for me this is a bug
 (eg dialog titles can be only 2 lines.. really - that's a problem in
 some languages where common words are way longer than in english). If
 enough people have this issue that they can't use the dialog title for
 titles anymore, then this might be changed in a future release.

 If you are using it for showing general messages, then don't use the
 title for this, use setMessage(message) (in AlertDialog.Builder or
 AlertDialog).


 Tauno




 On Fri, Mar 27, 2009 at 2:52 PM, Sahil Arora sahilz...@gmail.com wrote:
  Yes, i m using dialog titles. So going ahead do i need to replace my
 alert
  dialog with something else?? What is the suitable replacement u
 recommend??
  Thanks.
 
 
  On Fri, Mar 27, 2009 at 5:41 AM, tauntz tau...@gmail.com wrote:
 
  Are you using dialog titles?
 
  Somebody from the Android team decided that dialog titles can't be
  longer than 2 lines anymore. That means they can not be longer than 2
  words in some cases/languages. And no, nobody has explained the
  reasoning behind this move (other than - why are you using so long
  titles? don't use them!). It's also not documented at
  http://d.android.com/sdk/android-1.1.html why changes like this are
  not listed? Ask someone who knows :)
 
  Tauno
 
  On Fri, Mar 27, 2009 at 1:54 PM, Zhubham sahilz...@gmail.com wrote:
  
   Hi all,
  
   Alert dialogs which were properly displaying the full text (around 15
   words) in SDK-1.0 , are trimming down the text to around 5 words in
   SDK-1.1.
  
   eg.
  
   SDK1.0 = Welcome. This is an android based application. SDK used is
   1.1-Release 1.
  
   SDK1.1 =  Welcome. This is an android based app...
  
   Can someone help me with this??
  
   Thanks in advance.
  
   Regards,
   Zhubham.
   
  
 
 
 
 
  
 

 


--~--~-~--~~~---~--~~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog not centering vertically

2008-12-12 Thread Dianne Hackborn
Do the examples in ApiDemos show up how you expect?  If so, what is
different between your code and that?

On Thu, Dec 11, 2008 at 8:18 PM, redhookgroup redhookgr...@gmail.comwrote:


 Hey everyone,

  I have a few screens where I am using the AlertDialog.Builder to
 generate a dialog.  When I do show(), it shows up centered
 horizontally but is not centered vertically (seems to be typically
 lower than center).  I tried setting the gravity via dialog.getWindow
 ().setGravity() to CENTER but it seems to have no effect.  Oddly if I
 use the gravity of BOTTOM, the dialog appears at the bottom of the
 screen (as expected), but if I use gravity TOP, it shows up offset
 from the top of the screen by a fair amount.  Has anyone else
 encountered this issue (googling it doesn't appear to show anyone else
 encountering this).

 Any thoughts or suggestions would be greatly appreciated.

 Thanks,

 Andrew


 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~-~--~~~---~--~~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call in the run() method of a separate process.

2008-09-08 Thread hackbod

If you have created a separate thread to do work in the background
independent from the UI, you wouldn't want to be doing UI in that
thread. :)  Also, you can only do UI in a thread that is running a
message loop, NOT just a random thread you have spawned (though you
should get an exception thrown back if you try to do this).

I think you probably want to send a message to the original UI thread
and have it display the dialog there.  You can just post a Runnable to
the UI thread which takes care of displaying the dialog when its run()
method is called.

On Sep 8, 9:16 am, CG [EMAIL PROTECTED] wrote:
 Hello,

 I am facing a strange issue. I suppose it is due to my bad
 understanding of processes and compatibilities with processes.

 So here is the behavior I'd like to have :
 When I open my map, actions are done in background.
 So I use a progress dialog. For that I need an separate thread.
 But if an error occurs, I'd like to display a warning pop up. This
 popup show request is done inside the run method of the separated
 thread.

 And the warning dialog is never displayed ! I don't understand why.
 Can anyone explain me what is wrong ?
 I join my code snippet to give a picture of what i try to do.

 I also check the API demo and try to override the method
 OnCreateDialog method but with the same result :-(

 I suppose the issue is when I call the show().

 - Code snippet
 public class StationNearActivity extends MapActivity implements
 OnClickListener, Runnable {

     /** Called when the activity is first created. */
     public void onCreate(Bundle icicle) {

         pgd = ProgressDialog.show(this, null,
 getString(R.string.nearest_station_progress_dialog_wait));

 /*
  I create the dialog here
 -*/
         AlertDialog.Builder builder = new AlertDialog.Builder(this);

 builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
         dlg = builder.create();

 /*--
 if I display it there then it works ! But it is not the correct
 behaviour
 dlg.show()
 -*/

         super.onCreate(icicle);
         thisInstance = this;

         mapViewFromXML.setClickable(true);
         mapViewFromXML.setEnabled(true);

         }

         Thread threadOfMap = new Thread(this);
         threadOfMap.start();
     }

     public void run() {
         Looper.prepare();

         try {
             Thread.sleep(200);
         } catch (InterruptedException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }

         // --- Fill the map
         try {
             setMapCenter();
             if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
  mapCenter.getLongitudeE6() == 0)) {

 /*--
 The progress dialog dismiss works but the dialog show not !
 -*/

                 pgd.dismiss();
                 dlg.show();
             }

             Log.d(MAP, add overlay);
            //
             mapViewFromXML.postInvalidate();

         } catch (Exception e) {
             Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
         } finally {
             pgd.dismiss();
         }
     }

 }
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call in the run() method of a separate process.

2008-09-08 Thread CG

Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
W
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
W
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
W
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
W
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
W
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
Waww
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
Wawa
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun

Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
W
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
W
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
A
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call inthe run() method of a separate process.

2008-09-08 Thread secondsun
Wa
Sent via BlackBerry by ATT

-Original Message-
From: CG [EMAIL PROTECTED]

Date: Mon, 8 Sep 2008 10:02:58 
To: Android Developersandroid-developers@googlegroups.com
Subject: [android-developers] Re: Alert Dialog never displayed in when call in
 the run() method of  a separate process.



Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi [EMAIL PROTECTED] wrote:
 Hi,

 you can only display UI stuff from the main thread. You can use the
 Handler classes post() method to put the Dialog display in the event
 queue. Just have a look at the API docs.

 On 8 Sep., 18:16, CG [EMAIL PROTECTED] wrote:

  Hello,

  I am facing a strange issue. I suppose it is due to my bad
  understanding of processes and compatibilities with processes.

  So here is the behavior I'd like to have :
  When I open my map, actions are done in background.
  So I use a progress dialog. For that I need an separate thread.
  But if an error occurs, I'd like to display a warning pop up. This
  popup show request is done inside the run method of the separated
  thread.

  And the warning dialog is never displayed ! I don't understand why.
  Can anyone explain me what is wrong ?
  I join my code snippet to give a picture of what i try to do.

  I also check the API demo and try to override the method
  OnCreateDialog method but with the same result :-(

  I suppose the issue is when I call the show().

  - Code snippet
  public class StationNearActivity extends MapActivity implements
  OnClickListener, Runnable {

      /** Called when the activity is first created. */
      public void onCreate(Bundle icicle) {

          pgd = ProgressDialog.show(this, null,
  getString(R.string.nearest_station_progress_dialog_wait));

  /*
   I create the dialog here
  -*/
          AlertDialog.Builder builder = new AlertDialog.Builder(this);

  builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
          dlg = builder.create();

  /*--
  if I display it there then it works ! But it is not the correct
  behaviour
  dlg.show()
  -*/

          super.onCreate(icicle);
          thisInstance = this;

          mapViewFromXML.setClickable(true);
          mapViewFromXML.setEnabled(true);

          }

          Thread threadOfMap = new Thread(this);
          threadOfMap.start();
      }

      public void run() {
          Looper.prepare();

          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }

          // --- Fill the map
          try {
              setMapCenter();
              if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
   mapCenter.getLongitudeE6() == 0)) {

  /*--
  The progress dialog dismiss works but the dialog show not !
  -*/

                  pgd.dismiss();
                  dlg.show();
              }

              Log.d(MAP, add overlay);
             //
              mapViewFromXML.postInvalidate();

          } catch (Exception e) {
              Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
          } finally {
              pgd.dismiss();
          }
      }

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---