Through this code I can display the notification in a text message, but I want to save the text message by by sharedpreference until another notification arrives to replace it even if the application is closed
 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_result);
    String title = getIntent().getStringExtra("title");
    String message = getIntent().getStringExtra("message");
    setTitle(title);
    TextView desc = (TextView) findViewById(R.id.desc1);
    desc.setText(message);
}
}
 
     
    