Yes, the advice is indeed very good.

1. For the SQLite database bit, I think if parcelable is better than
serializable then
    can I simplyparcel my nested object and write it as a row to the
database?
   I think SQLite is going to be faster than shared preferences.

2. However at this point I am wondering what the difference is
    in using onActivityResult versus simply coding onRestart like so:

  @Override
  protected void onRestart() {

    // should be returning from activity

   if (this.hasPushedActivityB) {
     foo();
   } else {
     bar();
  }
}

// further down

this.hasPushedActivityB = true;

// start new intent

startActivity(new Intent(...));

//...

private boolean hasPushedActivityB;

Anything wrong with this alternative approach?

--------------------------------------------------------------

3. I will look at result receiver even though I have used
a Globals class annotated with each parameter that needs
to be passed from screen to screen. Not sure, maybe using
result receiver is beter.

Thanks,

John Goche

On Thu, Sep 22, 2011 at 1:08 AM, Richard Schilling <coderroa...@gmail.com>wrote:

> This is some good sound advice.  If you don't want to
> use startActivityForResult and onActivityResult then you can store your data
> in some "source of truth" like the SQLite database, or even shared
> preferences if you just have a few data items.
>
>
> Richard
>

Streets of Boston wrote:


> 1. Try to avoid Serializable. It is very slow compared to Parcelable.
> 2. Take a look at startActivityForResult and onActivityResult.
> 3. If you reeeaaally need to update activity A about events from activity
> B, consider putting your own subclass of ResultReceiver in the Intent's
> 'extras'. Then activity B can call 'send(...)' on that ResultReceiver and
> this will be received in activity A as an 'onReceiveResult(...)' call-back.
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to