protected override void OnSaveInstanceState(Bundle outState) { //serialize the current quote collection. StringWriter writer = new StringWriter(); XmlSerializer quoteSerializer = new XmlSerializer(quoteCollection.GetType()); quoteSerializer.Serialize(writer, quoteCollection); string currentQuoteCollection = writer.ToString(); outState.PutString("QuoteCollection", currentQuoteCollection); //save the number of right and wrong answers outState.PutInt("Right", right); outState.PutInt("Wrong", wrong); base.OnSaveInstanceState(outState); }
protected override void OnSaveInstanceState(Bundle outState) { // make writer StringWriter writer = new StringWriter(); // set up serializer XmlSerializer cereal = new XmlSerializer(quoteCollection.GetType()); // serialize quote collection cereal.Serialize(writer, quoteCollection); // get as string string quotes = writer.ToString(); // add to bundle outState.PutString(QUOTE_BUNDLE_KEY, quotes); base.OnSaveInstanceState(outState); }