I want to create widget in android with a button, edittext, spinner or more components. Help me please!!!
-
The is too broad and very vague. Do you want a single widget with a view with all of those on there? Do you want an AlertView with those on it? Please specifyC0L.PAN1C– C0L.PAN1C2016-06-23 16:13:30 +00:00Commented Jun 23, 2016 at 16:13
-
I have to show what did you try so farklappvisor– klappvisor2016-06-23 16:13:37 +00:00Commented Jun 23, 2016 at 16:13
1 Answer
You have to design the layout of you widget, is a normal layout file, but not all the view are allowed here.
Now you have to extend AppWidgetProvider and create your class, here you can override the methods triggered when the app widget is updated, deleted, enabled and others.
In the onUpdate() you can create a RemoteViews to set the layout you had created before.
Now is the time for appwidget-provider, an XML file that.
The last thing is to add widget to the manifest, within the application tags, you have to add receiver tag and the define intent filter and metadata.
I left to you the documentation https://developer.android.com/guide/topics/appwidgets/index.html and a little tutorial for a very simple widget: http://www.androidauthority.com/create-simple-android-widget-608975/
Hope this helps you.