On Fri, Sep 23, 2011 at 9:53 PM, Streets Of Boston
flyingdutc...@gmail.comwrote:
1) The onActivityResult will have a result-code of RESULT_CANCELED and its
'Intent data' parameter will be null.
2) Yes, you can pass back any Intent, even the one that started the
child-activity. You don't need
On Sun, Sep 25, 2011 at 6:26 AM, John Goche johngoch...@googlemail.comwrote:
Is it safe to refresh the screen widgets with the data in
onActivityResult() or is it better to do this inside onStart()?
It is safe and preferred - how would you know you were coming back from a
result in onStart()
On Thu, Sep 22, 2011 at 7:15 PM, John Goche johngoch...@googlemail.comwrote:
Not sure how to try this out on the emulator.
F12 or F11 or something causes the emulator to rotate. See the emulator
section in the Docs.
Since the Intent is returned to the parent activity inside
You can try this on the emulator. Hit Ctrl+F11 and you'll 'rotate' the
device.
setResult does not immediately return results back to its parent activity
(You can call setResult many times: only the last call to setResult will be
effective, superseding all previous calls)
The Intent you use
On Fri, Sep 23, 2011 at 3:27 PM, Streets Of Boston
flyingdutc...@gmail.comwrote:
You can try this on the emulator. Hit Ctrl+F11 and you'll 'rotate' the
device.
Yes, I saw the problem pop up with my onRestart() called when I wasn't
expecting it.
I can see the problem here with onRestart()
On Fri, Sep 23, 2011 at 1:38 PM, John Goche johngoch...@googlemail.comwrote:
1. if I don't pass an intent to setResult(), ie. use the one-parameter
version of setResult(), then will the null Intent be passed back to
my onActivityResult callback function?
2. Can I pass activity B's intent
1) The onActivityResult will have a result-code of RESULT_CANCELED and its
'Intent data' parameter will be null.
2) Yes, you can pass back any Intent, even the one that started the
child-activity. You don't need to create a brand new one.
When an Intent is passed back or forth between
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
Yes, a lot :)
Try out your code using 'hasPushedActivityB' and then rotate your phone or,
if it has a physical keyboard, slide out the keyboard:
The activities will be recreated and your 'hasPushedActivityB' of the new
activity A will be false, but the new Activity B will be showing.
Just use
On Thu, Sep 22, 2011 at 3:43 PM, Streets Of Boston
flyingdutc...@gmail.comwrote:
Yes, a lot :)
Try out your code using 'hasPushedActivityB' and then rotate your phone or,
if it has a physical keyboard, slide out the keyboard:
The activities will be recreated and your 'hasPushedActivityB' of
On Tue, Sep 20, 2011 at 5:38 PM, John Goche johngoch...@googlemail.comwrote:
I think I'm gonna go for serialization and write the serialized object to a
database in one row of text.
That's the quick and dirty way of doing things I guess.
Also, I'm done with Parcelable since I need to pass
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
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
--
You received this message because
Hello,
I have two A and B and clicking on a button in A opens B.
I pass an object from A to B using parcelable and the extras in the
intent used to open B. Now I have the following problem: given that
A is beneath B on the activity stack and will not be reopened, how
do I pass the object from B
You probably should reconsider your approach. It sounds like you need
a central data model, accessible from multiple activities:
-- database
-- file
managed by:
-- service
-- some other singleton
-- custom Application class
Extras on Intents should be viewed much along the lines of GET
On Tue, Sep 20, 2011 at 6:55 AM, John Goche johngoch...@googlemail.comwrote:
given that A is beneath B on the activity stack and will not be reopened
What do you mean A will not be reopened ?
You're probably looking for startActivityForResult() and onActivityResult().
Perhaps I can use the Serializable interface and simply serialize
On Tue, Sep 20, 2011 at 2:33 PM, Mark Murphy mmur...@commonsware.comwrote:
You probably should reconsider your approach. It sounds like you need
a central data model, accessible from multiple activities:
-- database
-- file
17 matches
Mail list logo