Monday, November 21, 2011

[android-developers] Re: onActivityResult not Triggering

To do this, you call the startActivityForResult(Intent, int) version
with a second integer parameter identifying the call. The result will
come back through your onActivityResult(int, int, Intent) method -
which you dont have .,...

just code that method for what you want it do do when it comes back an
very likely you can at least make progress

On Nov 20, 11:02 pm, Cody Duncan <cody10...@gmail.com> wrote:
> Hi guys,
>
> For some reason, an activity's onActivityResult method is not being
> called.  It is a tab within a tab Activity which is sending a
> startActivityForResult to an independent activity.  Here is the
> relevant code.
>
> in MealsTodayList class:
> void createEntry()
>         {
>                 Intent newMeal = new Intent(this, MealAdder.class);
>                 newMeal.setAction(NEW_MEAL);
>                 newMeal.putExtra(MealDbAdapter.KEY_DATE, todayDate);
>                 startActivityForResult(newMeal, NEW_ENTRY); //NEW_ENTRY=1
>         }
>
> in MealAdder class:
> public void saveNewEntry(View v)
>         {
>                 Intent mealEntryIntent = new Intent(this,MealsTodayList.class);
>                 [...]
>                 if (updatedEntry)
>                 {
>                         this.setResult(RESULT_EDIT_OK, mealEntryIntent);
>                 }
>                 else
>                 {
>                         this.setResult(RESULT_OK, mealEntryIntent);
>                 }
>                 finish();
>         }
>
> In this case, the activity MealAdder is completed once the save button
> is called, which calls this method.
>
> Any suggestions would be magnificent.  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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment