I am working on a project that need to inflating class form other
package.
Say the shared package called com.helloWidget.sharedresource, the
package using shared class called com.helloWidget.app.
In com.helloWidget.sharedresource, there is a commonWidget class
extends from ViewGroup and contains several View objects.
The Activity in com.helloWidget.app will inflate the commonWidget
class when being created.
Here are the code example:
      LayoutInflater inflater = (LayoutInflater)
context.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
      inflater = inflater.cloneInContext(shareContext);
      Resources shareres = shareContext.getResources();
      int resID = shareres.getIdentifier("commonWidget ", "layout",
shareContext.getPackageName());
      View v = inflater.inflate(shareres.getLayout(resID), null);

android:sharedUserId="helloWidget.uid.shared"  are declared in both
AndroidManifest.xml of two packages.

When I install two packages into emulator, it works fine.
com.helloWidget.sharedresource.commonWidget can be inflated correctly.
Here comes the strange thing, I put two applications into android
source code tree, and build a "system.img" out. And I am sure the two
packages are built-in successfully.
I start the system.img in emulator,  launch the helloWidget.app, and
then ClassNotFoundException occured !
com.helloWidget.sharedresource.commonWidget can not be found.
Then I removed the package "com.helloWidget.sharedresource" from the
build, and build another system.img
After this image started in emulator,  install the package
"com.helloWidget.sharedresource".
Magically it works again. com.helloWidget.sharedresource.commonWidget
can be found and inflated correctly.

It's very strange. The built-in package supposed to be found, or it
need extra install process?
Does anyone have any idea here?

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

Reply via email to