Discover time weather widget android, include the articles, news, trends, analysis and practical advice about time weather widget android on alibabacloud.com
Desktop widgets that recently need to write a DateTime are used to associate calendar programs, and desktop widgets have rarely been written before. Not very familiar with this technique, take the time to rearrange it today, and write down a simple time and date process.
The Desktop widget is a tool for displaying some information (some widgets are now being dev
First look at the effect:
The requirement is very simple. Add the weather query button to the menu and click it to display real-time weather.
Preparations:
1. Download Huawei SDK; http://imax.vmall.com/nj-campus/universityEpDown/toDownPage
2. Apply for an application to obtain the appid and appkey, which will be used later.
The simple idea is to first obtain
Android provides the widget for the date and time.Date WidgetDatePicker and Datepickerdialog,datepickerdialog are a simple container for loading datepicker. There is a trigger method Ondatechangedlistener () and Ondatesetlistener () respectively.In this example, we set up two buttons and a textview when the button pops up Datepickdialog.Step 1: Some Java functions about
App widgets are also a UI component that can embed a small program (program piece) into the desktop. Compared with common widgets (such as TextView and WebView), the following differences exist:
An App Widget is a live UI component that automatically updates its content;Widgets cannot automatically update their own content and can only passively wait for user calls;In applications, because of the automatic update feature of App widgets, it is suitable
broadcast message received... start to clean up memory... "); ActivityManager am = (ActivityManager) context. getSystemService (Context. ACTIVITY_SERVICE); List
Methods for obtaining available memory:
/*** Get the remaining memory available for the mobile phone ** @ param context * Context * @ return */public static long getAvailableMem (context) {ActivityManager am = (ActivityManager) context. getSystemService (Context. ACTIVITY_SERVICE); MemoryInfo outInfo = new MemoryInfo (); am. getMemor
Android Program-National Weather Forecast query (aggregated data development), android Weather Forecast
I. project demonstration effect:
Project source code:Http://yunpan.cn/cZVWIieuFyK9I access password 2eac
Ii. Use the aggregate data SDK: (1) aggregated data official website address: http://www.juhe.cn/
(2) regist
. This is an optional activity. When you add an app widget, it is loaded and allowed to modify the settings of the app widget during creation.
The following sections describe how to create these components:
Declare An application widget in the list
First, declare the appwidgetprovider class in the androidmanifest. xml file of the application, for example:
The
the app widget instances, this is a good place to do the job.
Ondisabled (context)
Called when the last instance of your app widget is removed from the host. You should do some cleanup work in the onenabled (context), such as deleting a temporary database.
OnReceive (context, Intent)
This is invoked when each broadcast is received, and before the callback function above. You don't usually need to imple
Develop weather software for Android (3) and weather for android
It takes nearly half a month to develop the Android weather software together in the previous article. I am sorry that there has been no update due to something. It
Android gets weather from China weather network, android ChinaEverything in http://download.csdn.net/detail/sun6223508/8011669 .. Can be completely transplantedLadies and gentlemen, the younger brother added the weather information of China's
to implement this method, because the default Appwidgetprovider implementation filters all app Widget broadcasts and invokes the above method appropriately.
Note: In Android 1.5, there is a known problem that the ondeleted () method is not invoked at the time of the call. To circumvent this problem, you can implement OnReceive () to receive this ondeleted () ca
information of the Widget, which defines the relevant information of the Widget, such as its width, length, and automatic update interval, the description is located in info under the xml directory. in xml.(3) Compile the provider file information of your Widget (xml/info. xml in this example)
Code highlighting produced by Actipro CodeHighlighter (freeware)Http:
Reference address: http://mobile.51cto.com/widget-290079.htm
Ndroid widget DevelopmentCase implementation is the content to be introduced in this article, mainly to understand and learnAndroid widget DevelopmentApplication. Let's write about it today.Android widgetOfDevelopmentBecause it's time to wait early in th
. The plug-in is adjusted at any time, and any time the launch expansion is used for the first time in the given boot (as the value does not span the startup duration).
Android 4.2
For android ?? Oid 4.2 (API grade 17) increases. This is an ideal method for the specified app
--Embedded software development
Name
Function module
Number of lines of code
Note
谢灿辉
widget
200
Desktop applet
Li Yangmin
GPS location, Baidu map API
100-150
Get your current City
Dingxiaofang
City Selection Activity , the weather API Get the
, so when any one of the appwidgetid changes, we needSynchronize other instances to maintain synchronization.
Appwidgetproviderinfo Class Supplementary Note:Publiccomponentnameconfigure: Typically an activity that indicates the complex need to manage appwidget creation operations.public int updateperiodmillis: Used to update appwidget, but the attribute was abolished in SDK1.5
Appwidgetprovider Class Introduction:Common methods:Ondeleted (): This method is called when the appwidget of the type
. For example:
Also, this activity must be declared using the Android: Configure attribute in the XML file of appwidgetproviderinfo. For example:
...Android: Configure = "com. example. Android. exampleappwidgetconfigure"...>
Note that this activity should be declared using a complete namespace because it will be referenced outside the scope of your package.
The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.