I developed a MediaPlayer with background service to handle playing of audio. When song is playing it shows notification of current song and also displaying on lock screen. Now my problem is that when I'm going to click on notification, the fragment, which contains the list of songs, is refreshing. I don't want to refresh the list. I just want to open the specific fragment in its original UI without changing its UI. Following is my code snippet which i use to call Fragment containing Activity.
=============================
Intent resultIntent = new Intent(this, MainActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(MainActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new NotificationCompat.Builder(getApplicationContext()).setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(resultPendingIntent).setContentTitle(PlayerConstants.SONG_NAME).build();
===================
在MainActivity.java下面的代码片段中打开片段。
=====================
getSupportFragmentManager().beginTransaction().replace(R.id.details, mFragment, Tag).setTransition(transition).commit();