Note that there are some explanatory texts on larger screens.

plurals
  1. POAfter orientation change buttons on a widget are not responding
    primarykey
    data
    text
    <p>I have two buttons on a widget that change some items in a widget, if an orientation is changed on a phone, buttons do nothing. I read <a href="http://developer.android.com/guide/topics/resources/runtime-changes.html" rel="noreferrer">http://developer.android.com/guide/topics/resources/runtime-changes.html</a> but this is all about activity not widget.</p> <pre><code> @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget); Intent active = new Intent(context, TvWidget.class); active.setAction(ACTION_WIDGET_RECEIVER); mDbHelper = new DbAdapter(context); fillChannelList(context, appWidgetIds[appWidgetIds.length-1]); Set&lt;Integer&gt; keys = channelsImages.keySet(); Iterator&lt;Integer&gt; iter = keys.iterator(); while(iter.hasNext()) { if(channelId == 0) { channelId = iter.next(); break; } } SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0); Editor edit = settings.edit(); edit.putInt("channelId", channelId); edit.putInt("appWidgetIds", appWidgetIds[appWidgetIds.length-1]); edit.commit(); active.putExtra("net.aerosoftware.tvvodic.appWidgetIds", appWidgetIds); PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0); remoteViews.setOnClickPendingIntent(R.id.button_next, actionPendingIntent); Intent refresh = new Intent(context, TvWidget.class); refresh.setAction(ACTION_WIDGET_REFRESH); refresh.putExtra("net.aerosoftware.tvvodic.appWidgetIds", appWidgetIds); PendingIntent refreshPendingIntent = PendingIntent.getBroadcast(context, 0, refresh, 0); remoteViews.setOnClickPendingIntent(R.id.button_refresh, refreshPendingIntent); updateView(context); appWidgetManager.updateAppWidget(appWidgetIds, remoteViews); super.onUpdate(context, appWidgetManager, appWidgetIds); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload