Reputation: 652
I want to create an android widget like CNN app widget. Let me explain you the follow of widget. I set on variable on shared preference to store category value if its null than open one activity which has list to select category and than load the data according to that category in widget. I put my code on onUpdate even in widget it will load data according to the category its working fine but my problem is when i am going to set my widget i just click on it and it will open the activity after i select the category it will close category activity but widget is not set on home screen so for that i have to again to the widget menu have to pic the widget and drop on the homescreen. so i want to open my category selection activity when user drop the widget on home screen. I google a lot but not find any solution for it. please help me out. Thank you in advance.
Upvotes: 0
Views: 530
Reputation: 14226
You need to set the configure Activity to the widgets's xml file like this:
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:configure="your.package.your.activity"
.... />
Here is the official documentation regarding this topic:
https://developer.android.com/guide/topics/appwidgets/index.html#Configuring
Upvotes: 1