android programming broadcastreceiver : I have taken some item as `spinner` in strings.xml file.and saving selected data in `sharedpreferrence`.Now i want to face the saving data from my `Broadcast receiver` class and want to make a text like "u need to contact with mr.x" and want to show as a notification text.how can i do it.my preferrence code is :


 

> Blockquote

public void saveinfo(View view) {
        SharedPreferences sp = getSharedPreferences("alarmatspecifictime", Context.MODE_PRIVATE);
         SharedPreferences.Editor editor = sp.edit();
        editor.putString("name", nameinput.getText().toString());
       // editor.putString("purpose", spinner.getText().toString());
        editor.putString("purpose",spinner.getSelectedItem().toString());
        editor.apply();
        makeText(this, "saved", LENGTH_LONG).show();

    
    and broadcast receiver class is
    
    public class AlarmReceiver extends BroadcastReceiver {
    
        private String Birthday, MarriageDay, Email, Contact, Visit, Meeting;
    
    
        @Override
        public void onReceive(Context context, Intent intent) {
            //Toast.makeText(context, "Your Time is up!!!!!", Toast.LENGTH_LONG).show();
            add_Notification(context);
    
    
        }
    
        public void add_Notification(Context context) {
            Log.d("ME", "Notification started");
    
            NotificationCompat.Builder mBuilder;
            mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(context)
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setContentTitle("This is showing My notification")
    
                    .setContentText("hello")
    
                    .addAction(R.drawable.ic_prev, "Yes", null)
    
                    .addAction(R.drawable.ic_prev, "No", null);
    
            NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
            mNotificationManager.notify(1, mBuilder.build());
        }
    
        //fetch data from sharedpreferrences
    
        public void get_pref(Context context) {
    
           SharedPreferences sp = context.getSharedPreferences("alarmatspecifictime", context.MODE_PRIVATE);
            String restoredText = sp.getString("purpose", "");
            String restoredname = sp.getString("name", "");
            //  Log.i("TAG", "data from shared prefs: " + restoredText);

 