Java tutorial
//package com.java2s; //License from project: Artistic License import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import java.io.Serializable; public class Main { public static void startActivityWithObjectForResult(Context context, Class<?> toClass, String key, Serializable obj, int requestCode) { Intent intent = new Intent(); intent.setClass(context, toClass); Bundle bundle = new Bundle(); bundle.putSerializable(key, obj); intent.putExtras(bundle); // int id =((IdObj)bundle.getSerializable(" ")).getId(); ((Activity) context).startActivityForResult(intent, requestCode); } }