ImageView of another Activity

0

How to use imageview of other activity ?

@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

    if (groupPosition == 0)

        switch (childPosition) {
            case 0:
                new Getimg().execute();
                Intent child0Intent = new Intent(this, ListViewLivros.class);
                postCat("http://192.168.1.207/api/v2/bookdemo/_table/cad_livro?fields=img_livro&filter=id_cat%20%3D%201", 1);

                byte[] imageAsBytes = Base64.decode(imgLiv.getBytes(), Base64.DEFAULT);
                livro2121.setImageBitmap(BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length));


                startActivity(child0Intent);
                break;

            case 1:
                Intent child1Intent = new Intent(this, ListViewLivros.class);
                startActivity(child1Intent);
                break;
        }
    return false;
}

Activity I want to use the image:

public class ListViewLivros extends ListActivity  {
    String[] itemname ={
        "Safari",
        "Camera",
        "Global",
        "FireFox",
        "UC Browser",
        "Android Folder",
        "VLC Player",
        "Cold War"
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    this.setListAdapter(new ArrayAdapter<String>(
            this, R.layout.mylist,
            R.id.Itemname,itemname));
    }
}

XML

  <ImageView
    android:id="@+id/livro2121"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_marginBottom="5dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="5dp"/>
    
asked by anonymous 13.07.2017 / 20:28

1 answer

1

I do not quite understand what you want to do. If you plan to select an image in a Activity to appear in another, you can popular Bundle to the second Activity with the option selected. So, depending on the chosen option you can load the desired image.

    
14.07.2017 / 21:28