I am working on android. My app contains a gallery of images. Every day I need to display one image as notification. i.e when notification is clicked it should open the GALLERY image and from there all the other images will be opened while swiping.
GridView.java
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
intent = new Intent(First.this, Gall.class);
intent.putExtra("pos", position);
startActivity(intent);
}
});
Gall.java
int posi;
Bundle extras = getIntent().getExtras();
if (extras != null)
{
posi = extras.getString("pos");
}
gal.setAdapter(new GallAdapter(this));
gal.setSelection(posi);
MyAlarmService:
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
mManager = (NotificationManager) this.getApplicationContext()
.getSystemService(
this.getApplicationContext().NOTIFICATION_SERVICE);
Intent intent1 = new Intent(this.getApplicationContext(), Gall.class);
Notification notification = new Notification(R.drawable.icon,
"Image of the Day!", System.currentTimeMillis());
intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingNotificationIntent = PendingIntent.getActivity(
this.getApplicationContext(), 0, intent1,
PendingIntent.FLAG_UPDATE_CURRENT);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(this.getApplicationContext(),
"My Images", "Image of the Day!", pendingNotificationIntent);
mManager.notify(0, notification);
stopSelf();
}
I have total 35 images. So daily at 8am one image will be displayed as notification and when the notification is clicked it should open that image and should redirect to gallery page. Now since there are 35 images I want to display one image per day.
From the above code, after 8am the notification will not come. So at that time the normal gallery class will be called from gridview and it is working fine. But when the notification comes then how can I send the position of the image to gallery class so that frst day 1st image, 2nd day second image,...upto 35. And after 35 again the position should start from 1,2,,,...
How can I do this? Please help me in this regard. Will be really thankfull