android - layout accessed from another APK could'nt access its drawable resources -
i accessed layout of apk accessing applicationinfo service , getting resources via packagemanager. works fine if textview , buttons specified in layout. throws resource not found exception
if drawable resource used in accessed layout.
this code access layout
applicationinfo info = packagemanager.getapplicationinfo( packagename, 0 ); resources res = packagemanager.getresourcesforapplication( info ); xmlresourceparser xres = res.getlayout( 0x7f030000 );
hello friend please try this.
packagemanager manager = getpackagemanager(); resources = manager.getresourcesforapplication(packname); int resid = resources.getidentifier("image1", "drawable", packname); log.d(tag, "resid = " + resid); drawable image = getresources().getdrawable(resid); log.d(tag, "resid = " + resid);