tutorial Android:
http://www.facebook.com/group.php?gid=268882243055&ref=mf

2010/1/5 Justin Anderson <[email protected]>:
> Code?
> ----------------------------------------------------------------------
> There are only 10 types of people in the world...
> Those who know binary and those who don't.
> ----------------------------------------------------------------------
>
>
> On Tue, Dec 29, 2009 at 3:29 PM, Syx <[email protected]> wrote:
>>
>> I get that. This is not the issue.  In both cases, the activity goes
>> through the same cycle and calls the same activity lifecycle methods.
>>
>> Also, the exception comes from the onSaveInstanceState method when I
>> try to a Serializable object in the Bundle. I don't see how adding
>> anything to the other methods will help?
>>
>> To explain better, this is what happens:
>>
>> [Start the activity]
>>  .. onCreate()
>>  .. onStart()
>>  .. onResume()
>>
>> [Rotate screen]
>>  .. onSaveInstanceState()
>>  .. onPause()
>>  .. onStop()
>>  .. onDestroy()
>>  .. onCreate()
>>  .. onStart()
>>  .. onResume()
>>
>> [Rotate back]
>>  .. onSaveInstanceState()
>>  .. onPause()
>>  .. onStop()
>>  .. onDestroy()
>>  .. onCreate()
>>  .. onStart()
>>  .. onResume()
>>
>> [Open a new activity in front of it or press home]
>>  .. onSaveInstanceState()
>>  -- > java.lang.RuntimeException: Parcelable encountered IOException
>> writing serializable object
>>  -- > Caused by: java.io.NotSerializableException
>>
>> On Dec 23, 10:04 am, Nithin <[email protected]> wrote:
>> > > However, if either press home, or open another app in front of mine
>> > > (eg, from the notification bar) then I get the following error:
>> >
>> > So, if you press home or open another activity through notification,
>> > your current Activity has lost focus and invisible, so it will be call
>> > onPause() and onStop() and open the new application. When coming again
>> > to your current Activity, its calling onRestart(), onStart() and
>> > onResume(). So you need to code accordingly.
>> >
>> > Nithin
>> >
>> > On Dec 22, 4:38 am, Syx <[email protected]> wrote:
>> >
>> >
>> >
>> > > Hi,
>> >
>> > > So I have an app that downloads and displays a list of messages. I
>> > > have two main classes that I use
>> > >  -  my own adapter which extends ArrayAdapter to display the list
>> > > items in a specific way
>> > >  - and a mailbox class which has an ArrayList in it amongst other
>> > > things
>> >
>> > > Both of these classes implement Serializable.  In my
>> > > onSaveInstanceState method, I have the following:
>> >
>> > >     @Override
>> > >     protected void onSaveInstanceState(Bundle outState) {
>> > >         super.onSaveInstanceState(outState);
>> > >         outState.putSerializable("savedAdapter", m_adapter);
>> > >         outState.putSerializable("savedMailbox", m_mailbox);
>> > >     }
>> >
>> > > I have nothing in my onStart/onResume/onPause/onStop/onDestroy
>> > > methods.  My onCreate method checks whether inState is null and does
>> > > the appropriate thing.
>> >
>> > > So here is my problem:
>> >
>> > > When I rotate the screen, onSaveInstanceState() saves the all three
>> > > objects, the activity is destroyed, recreated, and onCreate() extracts
>> > > them all perfectly. Great.
>> >
>> > > However, if either press home, or open another app in front of mine
>> > > (eg, from the notification bar) then I get the following error:
>> >
>> > > ERROR/AndroidRuntime(16961): java.lang.RuntimeException: Parcelable
>> > > encountered IOException writing serializable object (name = <my app>
>> > > $MessageAdapter)
>> > > ...
>> > > ERROR/AndroidRuntime(16961): Caused by:
>> > > java.io.NotSerializableException: <my app>$3
>> >
>> > > If I delete the relevant putSerializable line, then I get the same
>> > > error for Mailbox.
>> >
>> > > Why is it behaving in different ways when they are following exactly
>> > > the same activity life cycle?
>> > > And why would it throw an NotSerializableException at all when both
>> > > classes implement serializable and work when I rotate the screen?
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Beginners" group.
>>
>> NEW! Try asking and tagging your question on Stack Overflow at
>> http://stackoverflow.com/questions/tagged/android
>>
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-beginners?hl=en
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>
>
-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to