Android SDK bug?

Put your problem here if it does not fit any of the other categories.

Android SDK bug?

Postby lostgame » Tue Apr 14, 2009 3:34 pm

So I've got a dynamic integer variable that changes about every ten seconds depending on user input. As soon as the user input is detected, it displays a dialog, which uses the dialog.setmessage to set the dialog's text to this dynamic integer, that changes every time.

However, once I have displayed the dialog, the first time it shows correctly, but every time after that the message in the dialog is identical, even though I'm calling the same method to show it, and even though the variable is certainly changing.

What do I do?
lostgame
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Apr 02, 2009 8:59 pm

Top

Postby WarrenFaith » Tue Apr 14, 2009 8:50 pm

Have you used Log or debug to be sure, that the integer changes?
Can you provide some code snippets please?
WarrenFaith
Moderator
Moderator
 
Posts: 227
Joined: Fri Mar 13, 2009 10:59 am
Location: Berlin, Germany

Postby lostgame » Tue Apr 14, 2009 9:54 pm

Yeah, I've used log to ensure the variable changes, I know it changes because there's a lot of things (pretty much every other control in the application actually) reliant on this particular variable.

This is an extraordinarily large, corporate-level project and I'm under extremely strict NDA's, so I can't provide any source, unfortunately, and one of the terms of me being able to use these communities is that I have to stay intentionally vague, but I'll try to be as specific to the problem as I can if possible.
lostgame
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Apr 02, 2009 8:59 pm

Postby padde » Tue Apr 14, 2009 11:56 pm

did you set the text of the dialog to this int or do you
set the message everytime before you show the dialog?

Small example
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. AlertDialog ad = new AlertDialog.Builder(this)
  3.  
  4.     .setPositiveButton("Ok", null)
  5.  
  6.     .setTitle("title")
  7.  
  8.     .setMessage(String.valueOf(magic_int))
  9.  
  10.     .create();
  11.  
  12. ad.show();
  13.  
  14.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

This example will always show a dialog with the value the
integer had at the time the dialog was created.
If you want do show the actual value of the int you have to
renew the message of the dialog with

"ad.setMessage(String.valueOf(magic_int);" before you do
"ad.show();" again.


Greets
Padde
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 15 guests