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?
Junior Developer
Junior Developer
Posts: 18
Joined: Thu Apr 02, 2009 8:59 pm


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?
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.
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
  2. AlertDialog ad = new AlertDialog.Builder(this)
  4.     .setPositiveButton("Ok", null)
  6.     .setTitle("title")
  8.     .setMessage(String.valueOf(magic_int))
  10.     .create();
Parsed in 0.012 seconds, using GeSHi

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
";" again.

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


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 5 guests