0

I made a theme with drawables and strings, I can access the theme's resources by following commands

String packagename="com.....";
Resources res = context.getPackageManager().getResourcesForApplication(packagename);
int strid = res.getIdentifier(packagename+":string/"+name, "string", packagename);
int drawableid = res.getIdentifier(packagename+":drawable/"+name, "drawable", packagename);

String name = res.getString(resid);
Bitmap bmp = BitmapFactory.decodeResource(res, resid);
//or
Drawable dr=res.getDrawable(resid);

I can get the drawables, but I don't know how to set the drawables in xml to a widget. I only can set setImageViewResource(int viewid, int resId);

So I am asking that how to access xml resources from another apk and set widget drawables from it.

I want to access a resource like this from another theme apk, but I can only access the drawable (so can't use it for widgets)

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
        android:drawable="@drawable/wplayh" />
    <item android:drawable="@drawable/wplay" />
</selector>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Diljeet
  • 1,896
  • 20
  • 24

1 Answers1

0

you need a ContentProvider to share your app's data with another apps

Maciej Boguta
  • 1,354
  • 1
  • 12
  • 15
  • I already got the application resources from another apk(so i don't need content provider), but i am unable to use them on a widget, i mean in a xml drawable selector as mentioned in above xml code. – Diljeet Oct 30 '13 at 13:59