Activity call which is in the bank

I tried to call another action from my main activity, which is in the jar file.

Clazz class = Class.forName (getPackageName () + "." + GetActivityName ()); startActivity (new Intent (this, clazz));

I do it this way because I only know the class name. This works great, but unfortunately all resource files cannot be found when loading the activity from the jar file. When you first load the res file there is ResourceNotFoundException

:

04-30 11:18 AM: 46.944: ERROR / AndroidRuntime (1749): Thrown by: android.content.res.Resources $ NotFoundException: Resource ID # 0x7f040006

Any hints on this?

+2


a source to share


1 answer


Your JAR cannot reference resources.

More specific:



  • Your JAR cannot contain resources
  • Your Java code in a JAR cannot use R.layout

    either R.id

    or R.drawable

    or any of the constants R.

    to reference resources

You need to have all of your resources in an application that reuses the JAR, and your Java JAR code must either have the resource IDs that were passed to it (for example via method parameters) or use getIdentifier()

to find out the resource ID at runtime from the view String

name.

+3


a source







All Articles