I just tried a sample program, and it seems fine. There must be something going on in your onResume part...
Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com On Thu, Jan 13, 2011 at 12:09 AM, Paul <[email protected]> wrote: > UPDATE: > > Ok, so it looks like the following is happening... User starts the > activity, title is XXXXX. As a test, I then change the title in > onCreateOptionsMenu to YYYYY, and the UI changes immediately. > Finally, when the options-menu launched activity returns it's value, > ZZZZZ to onActivityResult, I then attempt to change the UI title again > from the currently shown YYYYY to ZZZZZ... but the title is instead > changed back to XXXXX..., even though an immediate call to getTitle > tells me that it should be ZZZZZ... > > Any ideas why this may be happening? > > Paul > > On Jan 12, 1:26 pm, Paul <[email protected]> wrote: > > Agreed, which is why it's so frustrating. > > > > As a test, in onCreateOptionsMenu() > > > > @Override > > public boolean onCreateOptionsMenu(Menu menu) { > > setTitle("changed"); > > . > > . > > . > > return super.onCreateOptionsMenu(menu); > > > > } > > > > Works fine. In onActivityResult() (this is the code, verbatim) > > > > @Override > > protected void onActivityResult(int requestCode, int resultCode, > > Intent data) { > > super.onActivityResult(requestCode, resultCode, data); > > > > // check the activity results > > switch (requestCode) { > > case RESULT_RENAME: > > if (resultCode == -1) { > > // activity ended successfully > > Log.d(LOG_TAG, "onActivityResult(): > > Changing title from " + getTitle() + " to " + > > data.getStringExtra(StylePad.Notes.TITLE)); > > > setTitle(data.getStringExtra(StylePad.Notes.TITLE)); > > Log.d(LOG_TAG, "onActivityResult(): > > New title " + getTitle()); > > } > > break; > > } > > } > > > > And the logging tells me that the title's been changed, but yet the UI > > is NOT updated... Have tried this on both a Galaxy Tab (2.2) and the > > 2.2 emulator. > > > > On Jan 12, 12:16 pm, Kumar Bibek <[email protected]> wrote: > > > > > It's a relatively simple problem. I am not sure what are you doing > wrong. > > > The title can be changed anytime from anywhere. > > > > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com > > > > > On Wed, Jan 12, 2011 at 10:43 PM, Paul <[email protected]> wrote: > > > > I posted this over at StackOverflow, but not much of a response... > > > > maybe someone else can run this on their testbed and verify? A > > > > strange problem... > > > > > > == > > > > > > Hi all. I have a simple app based on the Notepad demo application, > > > > and when a user is viewing/editing a note they can launch a dialog > > > > activity (TitleEditor) that allows them to change the title of a > note. > > > > Currently in the app, when viewing/editing a note, the notes' current > > > > title is shown as the activity title. > > > > > > So, I launch the TitleEditor dialog activity with > > > > startActivityForResult(), and in onActivityResult() I am successfully > > > > getting the new title back, no problem. > > > > > > The issue relates to then updating the notes view/edit (the active > > > > activity) title... using setTitle() in onActivityResult() with the > > > > data passed back does seem to set the title internally (a subsequent > > > > call to getTitle() shows the new title has been set), but the actual > > > > UI title is not updated until the activity is closed and then re- > > > > launched. > > > > > > I've used setTitle() in onResume(), onPrepareOptionsMenu(), etc and > it > > > > worked like a charm, but not working here... any ideas or > suggestions? > > > > > > Thanks, > > > > > > Paul > > > > > > -- > > > > 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]<android-developers%[email protected]> > <android-developers%[email protected]<android-developers%[email protected]> > > > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

