I'm creating a widget that had a button! When I click on a button. It just reads my location and toasts it! It should not open any activity! Just a toast on the button click in the widget! Need help!
1 Answer
You need to call
Toast.makeText(context, "Hi there!", Toast.LENGTH_LONG).show();
in widget's onClick() method of View.OnClickListener
2 Comments
Manjunath Prabhakar
For widget it extends from Appwidgetprovider!, Does the findviewbyId work in widget class?? I tried XML attribute android:onClick also, but couldn't make it work,, where as the toast is working fine in onUpdate, onEnabled and onDisabled methods
Manjunath Prabhakar
I did refer! I'm positive for invoking an activity on image button press! But I need a toast! I invoke a toast on a image button click!