In this exercise, a dummy home screen app widget will be described; to show the
simpliest element of a ndroid app widget.
- Create a new project of android application as normal, HelloWidget.
- Modify AndroidManifest.xml to have a receiver, with name of "HelloWidgetProvider", under Appliation.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exercise.HelloWidget"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloWidget"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="HelloWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/hellowidgetproviderinfo" />
</receiver>
</application>
<uses-sdk android:minSdkVersion="4" />
</manifest>
The element requires the android:name attribute, which specifies the AppWidgetProvider used by the App Widget.
The element must include an element with the android:name attribute. This attribute specifies that the AppWidgetProvider accepts the ACTION_APPWIDGET_UPDATE broadcast.
The element specifies the AppWidgetProviderInfo resource and requires the following attributes:
* android:name - Specifies the metadata name. Use android.appwidget.provider to
identify the data as the AppWidgetProviderInfo descriptor.
* android:resource - Specifies the AppWidgetProviderInfo resource location.
- Create a new folder /res/xml, create a new hellowidgetproviderinfo.xml
The
The
* android:name - Specifies the metadata name. Use android.appwidget.provider to
identify the data as the AppWidgetProviderInfo descriptor.
* android:resource - Specifies the AppWidgetProviderInfo resource location.
- Create a new folder /res/xml, create a new hellowidgetproviderinfo.xml
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="146dp"
android:minHeight="72dp"
android:updatePeriodMillis="10000"
android:initialLayout="@layout/hellowidget_layout"
>
</appwidget-provider>
It define the AppWidgetProviderInfo object in an XML resource using a single , include the essential qualities of an App Widget, such as its minimum layout dimensions, its initial layout resource, how often to update the App Widget, and (optionally) a configuration Activity to launch at create-time.
- Create a layout file /res/layout/hellowidget_layout.xml
- Create a layout file /res/layout/hellowidget_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
It's the layout of the widget. In this dummy exercisse, just copy the content of the auto-generated layout, main.xml.
- Create a class HelloWidgetProvider.java extends AppWidgetProvider. With nothing inside.
package com.exercise.HelloWidget;
import android.appwidget.AppWidgetProvider;
public class HelloWidgetProvider extends AppWidgetProvider {
}
It do nothing at all. Now you can build and Install the application as normal, then close it after started.
It's not own target in this exercise.
- Add the HelloWidget on Home Screen. It's
a dummy widget without any function, just show how to create a app widget.
Many inspirational stuff here in this post. Never knew that opinions could be this varied. Thanks for all the enthusiasm to offer such helpful information here.
ReplyDeleteApp Development Company
Thanks for sharing, I will bookmark and be back again
ReplyDeleteAndroid Application Development
This comment has been removed by the author.
ReplyDeleteA debt of gratitude is in order regarding gathering and imparting such pleasant assets for portable include engineers or any one who is intrigued by application improvement. I might like to include two other significant application stage.
ReplyDeleteBuild Android App // Mobile
Application Development // Android Application Development
We offer cross platform mobile solutions including SIP dialer to Android Application Development Company worldwide clients. We specialize in the development of business apps for iOS, Android, Windows, and SmartPhones.
ReplyDeleteThis blog is impressive and informative.It clearly explains about the concept and its techniques.Thanks for sharing this information.Please update this type of information
ReplyDeleteandroid Training in Chennai
Nice it seems to be good post... It will get readers engagement on the article since readres engagement plays an vital role in every blog.. i am expecting more updated posts from your hands.
ReplyDeleteiOS Training in Chennai
Android Training in Chennai
php Training in Chennai
Thank you for sharing this information. its useful and more informative
Mobile App Development Company
Android app Development Company
ios app development Company
Mobile App Development Companies
This is a really nice collection. Many thanks for gathering them all together for us. I’ve got a couple in mind for my next project.
ReplyDelete"That’s important information collection."
mobile app development for android
!!
Nice Post
ReplyDeleteAndroid Application Development Company
It is one of the wonderful blog.you provide a very wonderful information information which is useful to all the viewers to learn android.Thanks for sharing.keep sharing more blogs.
ReplyDeleteAndroid Training in Chennai
really nice blog has been shared by you. before i read this blog i didn't have any knowledge about this but now i got some knowledge about this. so keep on sharing such kind of an interesting blogs. Android Training in Chennai | Cloud Computing Training in Chennai
ReplyDeleteEveryone like this blog because you have written that much good content. Look into this Android Online Training Hyderabad for more information.
ReplyDeleteYour good knowledge and kindness in playing with all the pieces were
ReplyDeletevery useful. I don’t know what I would have done if I had not
encountered such a step like this.
mobile website builder
You've made some good points there. I looked on the internet for more information about this
ReplyDeleteMainframe Training In Chennai | Hadoop Training In Chennai | ETL Testing Training In Chennai
ReplyDeleteYou've made some good points there. I looked on the internet for more information about this
Mainframe Training In Chennai | Informatica Training In Chennai | Hadoop Training In Chennai
Good information. Keep posting like this blogs.
ReplyDeleteAndroid App Development Company in Pune
Software Development Pune
SEO Company in Pune
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteJava Training Institute Bangalore
Best Java Training Institute Chennai
Ciitnoida provides Core and java training institute in
ReplyDeletenoida. We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-
oriented, java training in noida , class-based build
of Java has made it one of most popular programming languages and the demand of professionals with certification in Advance Java training is at an
all-time high not just in India but foreign countries too.
By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13
years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best
Java training in Noida.
java training institute in noida
java training in noida
best java training institute in noida
java coaching in noida
java institute in noida
Sap Training Institute in Noida
ReplyDeleteCIIT Noida provides Best SAP Training in Noida based on current industry standards that helps attendees to secure placements in their dream jobs at MNCs. CIIT Provides Best ERP SAP Training in Noida. CIIT is one of the most credible ERP SAP training institutes in Noida offering hands on practical knowledge and full job assistance with basic as well as advanced level ERP SAP training courses. At CIIT ERP SAP training in noida is conducted by subject specialist corporate professionals with 7+ years of experience in managing real-time ERP SAP projects. CIIT implements a blend of aERPemic learning and practical sessions to give the student optimum exposure that aids in the transformation of naïve students into thorough professionals that are easily recruited within the industry.
At CIIT’s well-equipped ERP SAP training center in Noida aspirants learn the skills for ERP SAP Basis, ERP SAP ABAP, ERP SAP APO, ERP SAP Business Intelligence (BI), ERP SAP FICO, ERP SAP HANA, ERP SAP Production Planning, ERP SAP Supply Chain Management, ERP SAP Supplier Relationship Management, ERP SAP Training on real time projects along with ERP SAP placement training. ERP SAP Training in Noida has been designed as per latest industry trends and keeping in mind the advanced ERP SAP course content and syllabus based on the professional requirement of the student; helping them to get placement in Multinational companies and achieve their career goals.
Thanks for sharing this great article..Its really nice and useful for us.Website Designing Company Bangalore | Web Development Company Bangalore
ReplyDeletehttp://applockers.com
ReplyDelete
ReplyDeleteThanks for sharing such useful information.The content is high quality and results-oriented.Keep sharing more
Best python certification course in Bangalore
Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective.
ReplyDeleteWeb Designing Training in Chennai
Web Designing Course in Chennai
Web Designing Training in Bangalore
Web Designing Course in Bangalore
Web Designing Training in Hyderabad
Web Designing Course in Hyderabad
Web Designing Training in Coimbatore
Web Designing Training
Web Designing Online Training
Nice Blog!
ReplyDeleteFacing error while using QuickBooks get instant solution with our QuickBooks experts.Dial +1-855-533-6333 QuickBooks Enterprise Support Phone Number Alabama
Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
ReplyDeleteDigital Marketing Training in Chennai
Digital Marketing Course in Chennai
Content on your blog is really informative 50 High Quality for just 50 INR
ReplyDelete2000 Backlink at cheapest
5000 Backlink at cheapest
Boost DA upto 15+ at cheapest
Boost DA upto 25+ at cheapest
Boost DA upto 35+ at cheapest
Boost DA upto 45+ at cheapest
Brilliant post! We are connecting to this extraordinary post on our site. Keep up the extraordinary composition. news updates
ReplyDelete