[android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-13 Thread Eric Kraft
I think the approach you want to take here would be bundling 'extra's with your intent that you can read during the callback. Check out http://developer.android.com/reference/android/content/Intent.html#putExtra(java.lang.String,%20int) and

[android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-13 Thread Carl Lee
I haven't tried yet, but maybe you should see this: http://developer.android.com/guide/topics/resources/runtime-changes.html On Dec 12, 2:14 pm, bobetko bobe...@gmail.com wrote: In my app at some point I am making oAuth request to authorize user with Twitter. App opens WebView in which user

[android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-13 Thread Eric Kraft
It sounds like the best solution for you is to bundle the row id in your intent's extras and then get it back during the callback. Check out http://developer.android.com/reference/android/content/Intent.html#putExtra(java.lang.String,%20int) and

[android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-12 Thread bobetko
I thought about that. But, then another question come to my mind. Why wouldn't I always use SharedPreferences to save my activity state? For example: I passed groupID and itemID values into activity. In onCreate, I save both values to SharedPreferences. Latter, when activity is restarted (for any

[android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-12 Thread bobetko
Thanks Dianne, I've look at logs and my app is crashing because my RowID value is null. RowID is record ID that is needed to query sqlite database. I could post here all my code, but I doubt it would be very useful... I'll try explaining better with some code snippets: This is what I execute

Re: [android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-12 Thread Dianne Hackborn
onResume runs first then onCreate -- that is not typical. Either your activity is being restarted (due to a configuration change) or you have a new instance created. Also what do you mean by Twitter sends Intent (with token and secret) back to my activity? Do you mean it is using setResult()?

[android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-12 Thread bobetko
Sorry. Yes. You are right. onCreate runs first, then onResume next. (I am still learning about Android activity cycle :-) Here is my onResume method that handle this data that comes from Twitter. See lines 5 and 6. If 6 is true I am extracting token and secret and saving them to SharedPreferences.

Re: [android-developers] Re: onSaveInstanceState problem while making oAuth request

2010-12-12 Thread Dianne Hackborn
It is unlikely this has anything to do with saving and restoring instance state, unless a configuration change is happening or your process is being killed in the background. If you are saying that you are seeing onCreate() called, then again I think you should consider that you actually have a