Creating widgets

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Creating widgets

Postby danc81 » Fri Oct 02, 2009 6:19 pm

Hi,

I'm learning Android development and have an application running but I would like to create a widget to be placed on the home screen like Twitter or Google search. Is there a way to create and application which also provides a widget?

Thanks.
danc81
Freshman
Freshman
 
Posts: 3
Joined: Fri Oct 02, 2009 6:13 pm

Top

Postby MOnline » Mon Oct 05, 2009 10:32 pm

Hi danc81

To answer your question yes there is ;). But I guess thats not the answer you are hoping for. If you don't know how to create widgets yet please check out this website: http://jsharkey.org/blog/2009/04/24/for ... th-source/ as for creating an application (which is actually the right word) it is possible. I must say I haven't tried it out myself but I did google for it (a while back) and found this thread: http://www.mail-archive.com/android-beg ... 12692.html. Main difference is that this guy want to add multiple icons / entries to single application but it should get you going ;).

A small explanation about the thread i found. As I see it 1 apk is assumed to be a single application. Thats fine because we only want multiple activities with there own entry. If we look at the code below all we need to do is specify the activity name and the taskAffinity.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.     ...
  3.  
  4.     <activity android:name=".Foobar1" android:label="Foobar1" android:taskAffinity=".Foobar1">
  5.  
  6.     ...
  7.  
  8.     <activity android:name=".Foobar2" android:label="Foobar2" android:taskAffinity=".Foobar2">
  9.  
  10.     ...
  11.  
  12.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


Hope this helps. Btw let us know if the multiple programs in single apk stuff works. Could be usefull to have it verified.

With kind regards,

MOnline
MOnline
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Sep 21, 2009 9:51 pm

Top

Return to General

Who is online

Users browsing this forum: No registered users and 5 guests