首先获得图片的时候将路径设置为tag
iv_move.setImageResource(ids[position]);
iv_move.setTag(ids[position]);
db.execSQL("insert into myaccount(png,type,money) values(?,?,?) ",new Object[]{in_out.getPath(),in_out.getType(),in_out.getMoney()});
db.close();
在向数据库存图片时候存getTag ,然后用不带接收返回值的跳转
int path= (int) iv_move.getTag();
service=new MyAccountService(this);
service.add(in_out);
service.list.add(in_out);
Intent intent=new Intent(this, AcountListFragment.class);
intent.putExtra("inout",in_out);
startActivity(intent);
while (cursor.moveToNext()){
int id=cursor.getInt(cursor.getColumnIndex("id"));
int path=cursor.getInt(cursor.getColumnIndex("png"));
String type= cursor.getString(cursor.getColumnIndex("type"));
String money= cursor.getString(cursor.getColumnIndex("money"));
In_Out in_out=new In_Out(R.id.iv_shu,path,type,money);
list.add(in_out);
}