Create Android Widget



App widget is application that you can view on the home screen. You can receive instant update of the application from your home view. It is a special kind of user interface that are publish by using App Widget Provider. 

To Create App Widget, we need to use the following object AppWidgetProviderInfo object ,AppWidgetProvider  class implementation and XML view layout.

First, you need to declare AppWidgetProvider in your application AndroidManifest.xml.

Second, you need to add the AppWidgetProviderInfo Metadata define in the projects res/xml folder and set the minWidth,minHeight and ect.

Next, you must efine the initial App Widget in XML and save it in the res/layout folder. It is  very simple to create app widget layout if you are familiar with the Layout in Android Studio.

You also need to targetSDKversion > 14 and and set the widget_margin in your layout and save it in the res/values/dimens.xml.

You also need to use the AppWidgetProvider Class to extends the BroadcastReceiver to handle the App Widget Broadcast. Use the onUpdate() method call as essential setup. You also need to use the other method call such as onAppWidgetOptionsChanged(), onDeleted(Context,int[]) and onEnabled(Context) ect.

You also need to configure the setting when user adds new app widget. Create app widget configuration Activity in your Android Manifest files. You also need the update the app widget from the configuration Activity, setting a preview image and using app widgets with collections.




Create Android Widget Create Android Widget Reviewed by Admin on 5:58 AM Rating: 5

No comments:

Powered by Blogger.