Can one APK result in multiple icons/apps on the device?

by Andrew » Thu, 09 Jul 2009 00:36:26 GMT

Sponsored Links
 Hi all,

Curious if this functionality is present on the Android platform.  I'm
looking to package my apps into a single APK file, which when
installed would spawn multiple application icons on the device.  All
applications would be related and would talk to each other (this part
isn't a problem and is working fine).

Can I package multiple related apps in a single APK install file?



Can one APK result in multiple icons/apps on the device?

by Mark Murphy » Thu, 09 Jul 2009 00:41:37 GMT


That depends on what you mean by "app".

If you mean multiple icons in the Launcher, sure, no problem. Just have
all such activities have the standard intent-filter with <action
android:name="android.intent.action.MAIN" /> and <category
android:name="android.intent.category.LAUNCHER" />. Every activity with
that intent filter will show up with an icon.

If you want multiple entries in the Manage Applications list in
Settings, though, that cannot be done AFAIK.

In Android, an app = APK. What you are really creating with the multiple
icons is a single app with multiple user-initiated entry points.

Mark Murphy (a Commons Guy)  | 

Warescription: Three Android Books, Plus Updates, $35/Year


Sponsored Links

Can one APK result in multiple icons/apps on the device?

by Bryne McCullough » Wed, 05 Aug 2009 00:21:28 GMT

 'm trying to do the same thing as the original poster: That is, have
one APK, resulting in multiple icons in the Launcher app tray, each
icon launching a different Activity within my APK. Seems like a simple
thing, but it's not working for me.

I've posted my AndroidManifest.xml below. The behavior I'm seeing is
that I indeed get two icons in the Launcher app tray -- an icon for
Foobar1, and another icon for Foobar2. Both icons work as expected if
they're the first thing I click. That is, icon Foobar1 launches
Activity Foobar1, and icon Foobar2 launches Activity Foobar2.

However, if I launch Foobar1, then hit the home key (not the back
key!), then try to launch Foobar2, what I get is Foobar1 -- and vice

It seems like if either Foobar1 or Foobar2 are already instantiated
within the app's task, and I go back to the Launcher and attempt to
launch either Foobar1 or Foobar2, the Launcher simply brings my
already existing task to the foreground showing whatever Activity was
previously on top.

Any pointers? Thanks!

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
<application android:icon="@drawable/icon" android:label="Foobar">
<activity android:name=".Foobar1" android:label="Foobar1">
<action android:name="android.intent.action.MAIN"/>
<activity android:name=".Foobar2" android:label="Foobar2">
<action android:name="android.intent.action.MAIN"/>
<uses-sdk android:minSdkVersion="3"/>

On Jul 8, 9:41am, Mark Murphy <> wrote:


Can one APK result in multiple icons/apps on the device?

by Bryne McCullough » Wed, 05 Aug 2009 10:38:13 GMT

  think I have a solution figured out. As my limited understanding
goes, the launcher always launches Activities with
FLAG_ACTIVITY_NEW_TASK, which means the newly launched activity is
intended to be the root of a new task. However, if that task already
exists with a different Activity at its root, this doesn't work. So,
the solution to the example I pasted in my prior post with Activities
Foobar1 and Foobar2 would be to give those two Activities different
task affinities like so:

<activity android:name=".Foobar1" android:label="Foobar1"
<activity android:name=".Foobar2" android:label="Foobar2"

Clarifications would be welcome!

On Aug 3, 5:48pm, Bryne McCullough <>

Other Threads

1. Backing up SMS database on RC8 / RC30

I want to follow the instructions at this URL for rooting RC8 on my vanilla

However I'd like to back up my SMS database first, but I'm finding I can't
due to file system permissions (presumably due to the OTA update to RC8 just
after I got the phone taking away root)

I've seen a market app for backing up SMS to Gmail but I'd rather just have
the sqlite database off the device so I can properly restore it later on.

I've got a bit of a catch-22 situation here, wondering if anyone has any

Kind regards
Tom Fanning


2. Can Gallery(context,attrSet) constructor be used to instantiate a gallery which looks the same as one created with findViewById()?

I want to create a subclass of Gallery, but I don know any way to
instantiate a variable of such a subclass using findViewById().

Proposed code:
Public class MyGallery extends Gallery{
   Public MyGallery(Context ctx, AttributeSet attrSet) { // code for
constructor }
   // more code for subclass
MyGallery myGallery = (Gallery) findViewById(;  // but
this doesn workMyGallery myGallery = (MyGallery) findViewById(; // and
this doesn work
However, MyGallery can use super() constructors.  So if I can
instantiate a Gallery variable using constructors (such as Gallery
gallery = new Gallery(this, attribSet)) which would give me a Gallery
view which is equivalent to the one created with findViewById(), that
might be workable!  This assumes that it is even possible to get the
same gallery view using a constructor with ttribSet as the gallery
view obtained by using the findViewById() method.  Does  anyone know
if that is possible?  If so, how do I go about getting the correct
attribSet so I get a gallery which looks like the one instantiated
with findViewById()?

If it is possible, simplistically, I would like to do:
Gallery gallery = (Gallery) findViewById(;
MyGallery myGallery = new MyGallery(this, gallery.someMethodToGetAttSet
However, I can find any methods in Gallery which will return its
attribSet.  Do I need to use an XML parser to parse the
myself?  The info I found in the API regarding
android.utl.AttributeSet  is relatively brief, and I don understand
it well.  However, it seems that  AttributeSet recommends using
Resources.Theme.obtainStyledAttributes()  but the API is even briefer
on this, and I don understand: 1) how obtainStyledAttributes() which
returns a TypedArray helps me with getting an AttributeSet and 2)
since obtainStyledAttributes() requires an AttributeSet parameter
(which is what I was trying to get in the first place), where am I
supposed to get that?  I have tried googling but can seem to get any
more detailed instruction on this.

Does anyone know where I might find help in this regard?



3. using intents/intent filters and mime types

4. Google Cripples the Developer By Limiting Apps Storage

5. What could we do with Android with this kind of investment...

6. another round of emulator DNS problems

7. TIE (Track Incomes and Expenses) - Android application