LabelToDo 1.0.3 on the road!!! Changelog:
Version 1.0.3
★ New widget: Task quick add
★ Larger fonts for notification page
★ Minor bugfixes
Version 1.0.2
★ New widget: Label shortcut on home screen
★ Notification sound choice
★ More options for postpone notifications
★ Bug fixed for landascape screen orientation
Version 1.0.1
★ Custom font size
★ Minor bug fix
Next version
★ New widgets are coming!!!
13 giugno 2013
03 giugno 2013
Android development: shortcut vs widget part 2
Second part of post "Android development: shortcut vs widget", the code.
As from previous post the necessary steps to create a shortcut that user can add to his home screen are 3:
1. create the activity launched when the user adds the shortcut
This is the simplest task, you have only to create a class that exend Activity, in my case the acticity name is Widget1LabelShortcut.
2. add the previous activity to manifest.xml
You have to add the previous activity Widget1LabelShortcut to manifest.xml. It is a normal activity with an intent-filter as the following code.
Be careful, the shortcut will appear in the list of widgets (or shortcuts depending on the Android version ) with the application name as label . If you want to display a custom name you must add the field label in the manifest, as in the example below. This can be useful for the user to understand what the shortcut makes and if you create multiple shortcuts to avoid confusion.
3. write the code for activity Widget1LabelShortcut
And now the Activity code to create the shortcut.
In the simplest case this activity is invisible to the user and it only serves to create the shortcut, all the code will be in the method onCreate.
In other cases the activity can have its own ContentView, a layout and respond to user interaction that can customize the shortcut.
The code below with comments should be self explanatory.
As from previous post the necessary steps to create a shortcut that user can add to his home screen are 3:
- create the activity launched when the user adds the shortcut
- add the previous activity to manifest.xml
- write the code for previous activity
1. create the activity launched when the user adds the shortcut
This is the simplest task, you have only to create a class that exend Activity, in my case the acticity name is Widget1LabelShortcut.
2. add the previous activity to manifest.xml
You have to add the previous activity Widget1LabelShortcut to manifest.xml. It is a normal activity with an intent-filter as the following code.
Be careful, the shortcut will appear in the list of widgets (or shortcuts depending on the Android version ) with the application name as label . If you want to display a custom name you must add the field label in the manifest, as in the example below. This can be useful for the user to understand what the shortcut makes and if you create multiple shortcuts to avoid confusion.
<activity
|
3. write the code for activity Widget1LabelShortcut
And now the Activity code to create the shortcut.
In the simplest case this activity is invisible to the user and it only serves to create the shortcut, all the code will be in the method onCreate.
In other cases the activity can have its own ContentView, a layout and respond to user interaction that can customize the shortcut.
The code below with comments should be self explanatory.
@Override
|
Etichette:
android,
code,
development,
shortcut,
widget
Iscriviti a:
Post (Atom)