buttonclick - android widget update text using activity -


I want to update the widget item when I add the item using the activity on receiver () on my Welcome Widget class or Remove

  Public Zero on Recycled (Reference Reference, Intent of Intent) {Setup (Reference); If (datalist.size ()! = 0) {if (intent.getAction (.) Equals (ACTION_NEXT_TIP)} {mMessage = getNextMessageIndex (); SharedPreferences.Editor pref = context.getSharedPreferences (PREFS_NAME, 0) .edit (); pref.putInt (PREFS_TIP_NUMBER, mMessage); Pref.commit (); Fresh (); } And if (intent.getAction (.) Is equal to (ACTION_SETTING)) {intent of article endings = new intent (reference, LoremActivity.class); ArticleIntent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity (articleIntent); } Else {refresh}}}}   

where the refresh method is:

  Private Zero Refresh () {Remote power RV = Buildupdate (MCTX); {I.ic. }   

The use of the animation is as follows:

  animation set farsiTelLogoAnimation = new animation set ( true); Rotate Rotation Animation = New Rotat Animation (0, 360, Rotat Animation. RELATIVE_TO_SELF, 0.5 F, Rotat Animation. RELATIVE_TO_SELF, 0.5F); rotate.setFillAfter (true); Rotate.setDuration (1000); FarsiTelLogoAnimation.addAnimation;   

}

Receiving the message index Private Inc getNextMessageIndex () {

  Return (mMessage + 1)% datalist.size ( ); }   

where buildUpdate () method is in the form of

  Public RemoteView Buildupdate (Reference Reference) {Remote Visuals Update Wax = New Remote Power (context. getPackageName ()), r.layout.widget); // Action intact bcast = new intent to tap on bubble (reference, welcomwdt class); bcast.setAction (ACTION_NEXT_TIP); Pending pending = pending content. Gatebraska (context, 0, best, pending entity. FLAG_UPDATE_CURRENT); updateViews.setOnClickPendingIntent (R.id.widget, pending); // Remote Viez UpdateWeis 1 = New Remote Power (reference.GetPexName (), // RIDSetting); Intent bcast1 = new intent (reference, welcomeWidget.class); bcast1.setAction (ACTION_SETTING); Pending pending 1 = Pending. Gentlebrook (reference, 0, backtot 1, pending entity.FLAG_UPDATE_CURRENT); UpdateViews SetOnClickPendingIntent (R.id.setting, pending 1); // tip bubble text if (mMessage> = 0) {// string [] parts = sNewlineRegex.split (mTips [mMessage], 2); String to = Datlist. Gate (MMSs) .get for (); String = datlist.get (mmssage) .getTo (); String Rate = Datlist.Gate (MMSs) .Getrate (); // Find a callout graphic referred to in text micht = sDrawableRegex.matcher (to); If (m.find ()) {String imageName = m.group (1); Int resId = context.getResources (). GetIdentifier (imageName, null, context.getPackageName ()); // updateViews.setImageViewResource (R.id.tip_callout, resId); // updateViews.setViewVisibility (see R.id.tip_callout, // visual); To = m.replace first (""); } else {// updateViews.setImageViewResource (R.id.tip_callout, 0); 0 // updateViews.setViewVisibility (R.id.tip_callout, View.GONE); } UpdateViews.setTextViewText (R.id.to, to); UpdateViews.setTextViewText (from R.id.from,); UpdateViews.setTextViewText (R.id.rate, rate); UpdateViews.setTextViewText (R.id.tip_footer, context.getResources () .getString (R.string.pager_footer, (1 + mms), datlist. Size ())); UpdateViews.setViewVisibility (R.id.tip_bubble, see Visual); } Other {updateViews.setViewVisibility (see R.id.tip_bubble, see INVISIBLE); } See return updates; }   

where button click event reload widget

actually Understand your code because the format is terrible.

However, to update a widget with your activity, you can send a broadcast objective with APPWIDGET_UPDATE. Use the following code:

  intent to intent = new intent (your activity.This, YourWidgetProvider.class); intent.setAction ("android.appwidget.action.APPWIDGET_UPDATE"); Int's [] = AppWithManager.Get Instance (Receipt ()). GetAppWidgetIds (new element name (getApplication (), esqueerlogocoprocessor class)); intent.putExtra (AppWidgetManager.EXTRA_APPWIDGET_IDS, ID); SendBroadcast;   

Hope this helps :)

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -