This sounds much more complicated than you need.  If you just want to load
resources from another .apk, you don't need any code in it at all -- just
use Context.createPackageContext() to get the context for the other package
and load its resources from there.

And if you don't need any UI, and really do need to execute code in the
other .apk, then you said you already have a content provider so why not
just call that?  Or a broadcast receiver?  Or a service?

Also if you really do need to run the code in the other .apk, please
consider using android:sharedUserId with all of your .apks and having them
all run in the same process, so you don't need to spin up multiple
processes.

On Sat, Feb 13, 2010 at 8:06 AM, Menny <menn...@gmail.com> wrote:

> OK. I'll be explain my needs:
> I'm the author of AnySoftKeyboard (http://
> softkeyboard.googlecode.com).
> The reason I made this keyboard, is to provide alternative layouts in
> the on-screen keyboard (e.g., Hebrew, Russian, DVORAK, etc. and of
> course, qwerty).
> But the keyboard APK gets bloated with all the layouts, and
> dictionaries etc....
> So, I wanted to move all layouts to external packages: one layout (or
> several) per package.
>
> All the data I need to create a layout are the resource IDs of the
> layout, the dictionary and several other stuff, all of which can be
> retrieved using a ContentProvider.
> But I need the ContentProvider's URI.
> So I thought that starting an Activity and getting a result from it
> (startActivityForResult call) will be perfect for me.
>
> I do not need any UI to popuup (actually, I prefer that none will), I
> get need to get some data from the external package.
>
> So, these are my needs. Anyone can suggest a way?
>
> Thanks,
> Menny
>
> On Feb 12, 10:35 am, Kevin Duffey <andjar...@gmail.com> wrote:
> > The whole purpose of a service is to stay in the background doing
> something,
> > so not sure why you would want to display a UI in a non-UI based app. As
> > Dianne said, post a notification that shows up on the status bar... when
> the
> > user slides it down and clicks on it, that can launch an activity...
> which
> > can then bind to the service to pass it info if need be. I'd still argue
> > that would not be a good idea either. Can you elaborate on why you need
> some
> > user interaction with your service.. is it something that can't be,
> perhaps
> > set in a user preferences within an activity that the user launches the
> > first time (or later to change settings)?
> >
> > On Thu, Feb 11, 2010 at 7:53 PM, Dianne Hackborn <hack...@android.com
> >wrote:
> >
> > > You can't do this, nor should you.  This would pop your UI in front of
> the
> > > user, disrupting whatever they are doing.  This is highly discouraged.
>  The
> > > proper way to do this is to post a notification, which the user can
> respond
> > > to when desired and can cause your own activity to be launched, which
> can
> > > then launch the other activity.
> >
> > > On Thu, Feb 11, 2010 at 11:17 AM, Menny <menn...@gmail.com> wrote:
> >
> > >> Hi,
> > >> I have a Service which needs to receive data from external packages.
> > >> So, to locate the data providing external packages, I use activity-
> > >> filter and PackageManager.queryIntentActivities function to locate the
> > >> interesting packages.
> > >> Now, from each such package, I need to get a ContentProvider URI.
> > >> So I want to start the external Activity and the external activity
> > >> will return a result to my service - something like
> > >> "startActivityForResult".
> > >> The problem is that there is no way to call "startActivityForResult"
> > >> from a Service, only Activity can do that, and my project does not
> > >> have any Activity, and probably can't show UI for the user.
> >
> > >> The bottom line:
> > >> Can anyone suggest a way to get ContentProvider URI from an external
> > >> package, while my package has only a Service?
> >
> > >> Thanks,
> > >> Menny.
> >
> > >> --
> > >> You received this message because you are subscribed to the Google
> > >> Groups "Android Developers" group.
> > >> To post to this group, send email to
> android-developers@googlegroups.com
> > >> To unsubscribe from this group, send email to
> > >> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
> >
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > hack...@android.com
> >
> > > Note: please don't send private questions to me, as I don't have time
> to
> > > provide private support, and so won't reply to such e-mails.  All such
> > > questions should be posted on public forums, where I and others can see
> and
> > > answer them.
> >
> > >  --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to