I am trying my hand at Remote Views in android. So I created 2 apps. A -> Sends a bundle containing RemoteView and a string on an AIDL call. B -> Makes the AIDL call on Button click to fetch the data and immediately launches a activity to display the Remote View.
Here is the activity I am using to display the remote view:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent i = getIntent();
Bundle b = i.getBundleExtra("bundle");
RemoteViews rv = (RemoteViews) b.getParcelable("RemoteView");
String t = b.getString("test");
Log.i("RemoteViewDisplay","String: " + t);
View v = rv.apply(getApplicationContext(), null);
setContentView(v);
}
I am getting the string I sent along with the Remote View but I am unable to display the remote view.
Below is the code executed when AIDL is called.
Log.i("TimeMessageService", "getRemoteViews called.");
int i = getCallingUid();
PackageManager pm = service.getPackageManager();
String name = pm.getNameForUid(i);
RemoteViews rv = new RemoteViews(name, R.id.imageView);
Bundle b = new Bundle();
b.putParcelable("RemoteView", rv);
b.putString("test", "testString");
return b;
But I keep getting a resource not found exception for Resource ID #0x7f060000.
Any ideas where is my mistake.
Thanks in advance.
EDIT:
Image View Layout
<?xml version="1.0" encoding="utf-8"?>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon" />