How to show a toast message when widget is clicked in android -
i created widget app , works perfectly. need show toast message while clicking on widget. possible tried below code.
public void updateview(context context) { remoteviews thisviews = new remoteviews(context.getapplicationcontext().getpackagename(), r.layout.widget_layout); thisviews.setonclickpendingintent(r.id.relativelayout1, actionpendingintent(context)); thisviews.settextviewtext(r.id.widget_text, batterylevel); thisviews.setimageviewresource(r.id.imageview1, widgetimageframe); componentname thiswidget = new componentname(context, batterystatuswidgetactivity.class); appwidgetmanager.getinstance(context).updateappwidget(thiswidget, thisviews); } public static pendingintent actionpendingintent(context context) { intent intent = new intent(context,launchactivity.class); intent.setaction("launch_activity"); return pendingintent.getactivity(context, 0, intent, pendingintent.flag_update_current); }
the above sample launch activity, need toast message.
thanks in advance
Comments
Post a Comment