1. use if you want to send image and text of current view of list adapter to next activity
ListView lv = (ListView) arg0;
TextView name=(TextView)arg0.getChildAt(arg2-lv.g
final List<String> Items = new ArrayList<String>();
String[] array = Items.toArray(new String[Items.size()]);
StringBuilder builder = new StringBuilder();
for (String s: array) {
builder.append(s);
builder.append(" ");
}
ListView lv = (ListView) arg0;
String fieldname = names[arg2];
Toast mtost=Toast.makeText(getApplicationContext(),fieldname, T
oast.LENGTH_SHORT);
mtost.show();
/// fishtextview=(TextView)findViewById(R.id.textView1);
TextView name=(TextView)arg0.getChildAt(arg2-lv.g
etFirstVisiblePosition()).findViewById(R.id.textView1);
name.setText(fieldname);
TextView desc = (TextView)arg0.getChildAt(arg2-lv.
getFirstVisiblePosition()).findViewById(R.id.textView2);
ImageView img=(ImageView)arg0.getChildAt(arg2-lv.
getFirstVisiblePosition()).findViewById(R.id.icon);
img.buildDrawingCache();
Bitmap bmap = img.getDrawingCache();
Intent i = new Intent(getApplicationContext(), Second.class);
Bundle extras = new Bundle();
extras.putParcelable("imagebitmap", bmap);
i.putExtras(extras);
i.putExtra("text", fieldname.toString());
i.putExtra("desc", desc.toString());
startActivity(i);
2. String ArrayList to String Array and Setting Text to edit Text
final List<String> Items = new ArrayList<String>();
StringBuilder builder = new StringBuilder();
for (String s: array) {
builder.append(s);
builder.append(" ");
}
No comments:
Post a Comment