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); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -