I initialize my lists in my activity onCreate() like below:
private List<MyItem> filtered;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard);
filtered = new ArrayList<>();
// more things
}
And when i try to use filtered items from onNewIntent sometimes i get a null pointer exception.
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
filtered.clear();
}
How could it be possible?
Edit: My Activity's launchmode is SingleTask
Edit 2:
I cannot send more useful logs because this crash is in production. Only i get some fabric logs.
Thanks for your help but i cannot paste whole code cause of privacy.
I think i have a problem on SingleTask-OnCreate-OnNewIntent usage. Simply i'm trying to open my app from notification with a parameter decides which fragment will be opened when user navigates to activity.
Do you have any examples about this which contains SingleTask-OnCreate-OnNewIntent implementations?
Thanks to all for help.