Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to save finger drawing on orientation changes?

 
Dmitri Pietel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I've got the following problem - there's a custom View which is used for drawing and is hosted in MainActivity. After screen orientation changes the drawing disappears. Can anyone please give me a hint about it. Here's my view:

 
Dmitri Pietel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I thought I would store EventList in ArrayList, put it in Bundle and restore in onSaveInstanceState:



Getting NPE in this line: when calling performTouchEvent() after rotation
 
Tim Moores
Bartender
Posts: 3127
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to save and restore all instance variables. Otherwise the objects have their default value, which is null.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic