This can be done by giving your appwidget a state, which defines the page it currently shows. And assign broadcast to the buttons to change state.
- Send broadcast when buttons are clicked using PendingIntent.
- Have a receiver listen to broadcast and keep track of state (page)
- Update the appwidget depending on the current state
Here is some incomplete code example:
RemoteViews remoteViews = new RemoteViews(mContext.getPackageName(), R.layout.widget_weather);
// update appwidget remoteviews depending on state (ie which page to show)
remoteViews = populateViews(remoteViews, mState);
// set next button
Intent intent = new Intent(MYBROADCAST_NEXT);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, flags);
remoteViews.setOnClickPendingIntent(R.id.appwidget_btn_next, pendingIntent);
// set prev button
intent = new Intent(MYBROADCAST_PREV);
pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, flags);
remoteView.setOnClickPendingIntent(R.id.appwidget_btn_prev, pendingIntent);
// update the AppWidget ...
Hope this helps to achieve what you want.