Hello! Recently I started learning android. It is necessary to transfer data (string image link, string id, string username) from listItem to another activity. How can I do that? Thank you in advance

    1 answer 1

    Using intent

    We send

     Intent intent = new Intent(this, ViewActivity.class); intent.putExtra("url", "img url"); startActivity(intent); 

    Getting out

     Intent intent = getIntent(); String imgUrl = intent.getStringExtra("url"); 

    In general , read here .

    Get data from listview

    • Yes, I know about putExtra (), so how can I get this very url from the selected listItem? - lounah
    • Do you have it somewhere? In an array for example? - Vladimir VSeos
    • Yes, exactly, thanks - lounah
    • I added a link, look, there about how to get from the listview. - Vladimir VSeos