android widget unresponsive -


I have a widget that you press and then it will update the text on the widget. I have set one at the click listener to launch another activity to update the text, but for some reason it works temporarily and then it will be unresponsive and will not do anything when pressed. Does anyone know why this can happen? I have posted my widget code down in case it is useful.

  @Override public void onUpdate (REFERENCES, AppWidgetManager appWidgetManager Int [] appWidgetIds) {thisWidget = new ComponentName (reference, MemWidget. Class); Intention = Intention = Intent (reference, updatewidget.class); Pending pending vertical positioning = pending.activity (reference, 0, intent, 0); // Get the layout for the application widget and click on the attached one button to the listener RemoteViews = New RemoteViews (context.getPackageName (), R.layout.widget); Views.setOnClickPendingIntent (R.id.ImageButton01, Pending Pending); // Tell AppWidgetManager to update on current app widgets AppWidgetManager.updateAppWidget (thisWidget, view); } @ Override public leak at zero (reference reference, intention intent) {appWidgetManager = AppWidgetManager.getInstance (reference); RemoteViews = New Remote Power (context.getPackageName (), R.Letite.Videt); ThisWidget = new component name (context, MemWidget.class); // v1.5 is fixed that does not call on the handheld action final string action = intent.getAction (); If (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals (action)) {final int appWidgetId = intent.getExtras () getInt (AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID). If (appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID!) {This.onDeleted (reference, new int [] {appWidgetId}); }} And {super. Reaction on (context, intent); }}  

The code that is called by my activity

  thisWidget = new ComponentName (This, MemWidget.class); AppWidgetManager = AppWidgetManager.getInstance (this); RemoteViews = New Remote Power (this.getPackageName (), R.Letite.Videt); // do work Remote remote.Views.setTextViewText (R.id.ImageButton01, "setting text here"); AppWidgetManager.updateAppWidget (this widget, remote view);  

onUpdate method there pending does not update RemoteViews than any other data Identity, so if he is ever called, then the widget will return to the state defined in R.layout.widget.

Do you have code that tells the update app widget after the user's contacts? This can also help.

In addition, if the update is inline and no UI is required, then you do not need to launch an activity to perform that update. It is more efficient and will not disrupt the back stack if your pending projection is for the broadcast receiver instead, then using the pending Intent.getBroadcast. You can use a broadcast receiver similar to the same app widget provider, you do not need any other.


Update: (I can not answer below because the text is too long)

d create a function like this, and it is upset Call from your activity from (), you will have to save the text somewhere so that you can pass it on the up-date () too. Otherwise this text will return to the default in R.layout.widget.

  void update Widget (REFERENCES, Charsavens text) {remote wee Rimotwug = new remote wee (context.getPackageName (), r. Layout.widget); Pending pending vertical positioning = pending.activity (reference, 0, intent, 0); RemoteViews.setOnClickPendingIntent (R.id.ImageButton01, pendingIntent); RemoteViews.setTextViewText (R.id.ImageButton01, text); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance (reference); Component-thisWidget = new element name (context, MemWidget.class); AppWidgetManager.updateAppWidget (this widget, remote view); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -