0

I have this code of a listview and I need when I click in every item in the list I want to get the content of item (IMAGE AND TEXT) then I need to send them to an other activity contain (tabhost) this is my code:

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int 
position, long id) {
            Intent intent = new Intent(Detail_Activity.this, 
            MoreDetailActivity.class);

            LayoutInflater mInflater = getLayoutInflater();
            View myView = mInflater.inflate(R.layout.detail_item, null);


            TextView txtid = (TextView) view.findViewById(R.id.tv_name);
            ImageView img = (ImageView) view.findViewById(R.id.img_id);
            String stg = txtid.getText().toString();



        }
    });
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Sîï Mô
  • 1
  • 1
  • Possible duplicate of [Getting Image from ImageView](https://stackoverflow.com/questions/9042932/getting-image-from-imageview) – Micer Mar 18 '18 at 21:50

1 Answers1

1

Try this

String stg = view.getText().toString();

This snippet shows how to get an imageview from a listview

 ImageView img = (ImageView) view.findViewById(R.id.img_id);
        final BitmapDrawable bitmapDrawable = (BitmapDrawable) img.getDrawable();
        final Bitmap yourBitmap = bitmapDrawable.getBitmap(); 
        img.setImageBitmap(yourBitmap);

hope it helps !

Gastón Saillén
  • 12,319
  • 5
  • 67
  • 77