I got a widget with a listview. Whenever the user presses an item from the listview, i want to receive a Parcelable object compiled in the Adapter of the Widget listview.
So far everything works except that i cannot receive Parcelable objects (everything else works fine)
Adapter:
@Override
public RemoteViews getViewAt(int position) {
...
Intent fillIntent = new Intent();
fillIntent.putExtra("info", info); //info is a parcelable object
fillIntent.setData(Uri.parse(fillIntent.toUri(Intent.URI_INTENT_SCHEME)));
listViewItem.setOnClickFillInIntent(R.id.widget_listview_item, fillIntent);
...
}
Provider:
@Override
public void onReceive(Context context, Intent intent){
...
else if(intent.getAction().equals(ACTION_CLICK_LISTITEM)){
Info info = intent.getParcelableExtra("info");
// show details
if(info != null){
Intent startIntent = new Intent(context, DetailActivity.class);
startIntent.putExtra("info", info);
startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startIntent.setData(Uri.parse(startIntent.toUri(Intent.URI_INTENT_SCHEME)));
context.startActivity(startIntent);
}else{
Log.i(Constants.LOG_TAG, "info is null.");
}
}
...
}
I always log "info is null."...
NOTE: Sending objects of type Info as parcelables to other activities works just fine in my app. I only got problems when sending the parcelable object in combination with setOnClickFillInIntent.
Any help appreciated.
Regards John
Aucun commentaire:
Enregistrer un commentaire