I am working on a project where I need to use the ViewFlipper view inside Remoteview in the notification panel. I am currently facing the showNext () and showPreview () problem. But, unfortunately, showNext () and showPreview () are not called when the button is called. I am also posting my code for reference. Please help me where I make a mistake and correct me if my question is not clear.
private Notification setCustomViewNotification() {
Intent resultIntent = new Intent(this, ResultActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(ResultActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
expandedView = new RemoteViews(this.getPackageName(), R.layout.notification_viewflipper);
expandedView.setOnClickPendingIntent(R.id.img_left,getPendingSelfIntent(MainActivity.this, IMAGE_LEFT));
expandedView.setOnClickPendingIntent(R.id.img_right,getPendingSelfIntent(MainActivity.this, IMAGE_RIGHT));
Notification notification = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setAutoCancel(true)
.setContentIntent(resultPendingIntent)
.setContentTitle("Custom View").build();
notification.bigContentView = expandedView;
return notification;
}
so when the click event fires, I have to change the ViewFlipper elements. Below is the code in which I am completely stuck.
public void onEvent(ViewFlipperClickEvent event){
if(event.getTag().equals(MainActivity.IMAGE_LEFT)){
expandedView.showPrevious(R.id.ViewFlipper01);
}else if(event.getTag().equals(MainActivity.IMAGE_RIGHT)){
expandedView.showNext(R.id.ViewFlipper01);
}
}
Thank you in advance
source
share