1

The activity in the manifest is singleTask. The onNewIntent method is called when the activity is called again. I do intialize the Textviews and other views in my onCreate but sometimes the app crashes in onNewIntent where I do not initialize any variables and directly use the method of that view. For eg, setText method of TextView. Sometimes it throws NullPointerException and do not know why does it do so. In other screen where I have done the same thing it never does that.

Do I need to instantiate the variables again in onNewIntent?

sunil
  • 9,541
  • 18
  • 66
  • 88
  • In principle not. Please check some similar questions/answers: http://stackoverflow.com/questions/3688898/android-behaviour-of-launchmode-singletask-not-as-described http://stackoverflow.com/questions/2688763/passing-bundle-to-activity-set-as-singletask http://stackoverflow.com/questions/2417468/android-bug-in-launchmode-singletask-activity-stack-not-preserved – Zelimir Feb 21 '11 at 15:06

1 Answers1

0

Did you try solution that proposed by user znq in this discussion? It should clarify the situation.
Now it seems a bit strange. May be problem elsewhere.

Community
  • 1
  • 1
AlexKorovyansky
  • 4,873
  • 5
  • 37
  • 48