Maybe I shouldn't use the builder...could it be the problem of the data loosing? :S
On 9 mar, 19:25, LeGeNDuS <[email protected]> wrote: > Thanks! > > I have been trying onPrepareDialog...and well...what I see is that it > put the info for the first time, but when I change the orientation the > part what is shown is only the thing that is done when it pass by > onCreateDialog. > > So the first time, it put what I want, and when I change the > orientations it put like showActionDialog wants.... here the code: > > @Override > protected Dialog onCreateDialog(int id) { > Dialog dialog; > switch(id) { > case ACTION_DIALOG: > dialog = showActionDialog(); > break; > default: > dialog = null; > } > return dialog; > } > > @Override > protected void onPrepareDialog(int id,Dialog dialog) { > switch(id) { > case ACTION_DIALOG: > ((AlertDialog)dialog).setMessage("hola"); > break; > } > } > > Before change the orientation I get "hola" after that what > showActionDialog puts.....so then what must I do? copy > showActionDialog in both functions adapting it for each one?. Or I > must do it only for onPrepareDialog and let onCreateDialog so?: > > @Override > protected Dialog onCreateDialog(int id) { > return null; > } > > Apart of that... about the problems of loosing data in orientation > changes...you say that how the dialog has been created before, it > doens't matter to loose that values. And yes, I don't need them. But > the problem is the dialog lose all when I change the orientation, it > only keeps the negative button and the positive and mesage is lost.... > I have tried with shared preferences, and it works...but yes...it's > like you say.....a very hard fix to a supposed easy problem.... But I > have not found other choice.... > . > > On 9 mar, 18:16, TreKing <[email protected]> wrote: > > > > > On Tue, Mar 9, 2010 at 4:48 AM, LeGeNDuS <[email protected]> wrote: > > > classcodecategory and classtexout are fields of the class. I suppose > > > that the problem is that....when I change the orientation...it only > > > keep the negattive button because it is a normal text (no > > > contextualized of that fields). So when I change the orientation, > > > classcodecategory and classtextout lost their values. And when it goes > > > to change the dialog (for the orientation change) it fails for that > > > (because those fields are used to show in the dialog). Maybe should I > > > use sharedprefrences to keep those values?. > > > That shouldn't make a difference, I don't think, as the dialog should retain > > it's state as it was after it was created - so the parameters used to create > > it shouldn't matter at that point. I wouldn't use SharedPreferences unless > > it made sense to do so (i.e., these values need to persist across > > application restarts). > > > About the second one error (showing another times the dialog) I think > > > > I must indicate explicitly to close the previous dialog to force using > > > onCreateDialog at activity.showDialog... is it right? how can I do it? > > > You COULD call Activity.removeDialog() to force it to be recreated next time > > you try to show it, but that's not really necessary. For the 3rd time, > > onPrepareDialog() is here for this very reason: to give you the opportunity > > to update a previously shown dialog with new information. USE IT. > > > --------------------------------------------------------------------------- > > ---------------------- > > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

