How to pass Listview selected item values to another activity

前端 未结 2 1052
春和景丽
春和景丽 2021-01-15 02:19

I have successfully added Images from a ListView to a detailed View, when an item in the list is clicked on.But how would I add longer descriptions (which would not be shown

相关标签:
2条回答
  • 2021-01-15 02:55

    sending string:

    i.putExtra("longdesc", longdesc);
    

    reading string at destination:

    String longdesc = i.getStringExtra("longdesc");
    
    0 讨论(0)
  • 2021-01-15 03:02
        Intent i = new Intent(getApplicationContext(), SingleListItem.class);
                i.putExtra("str", longdesc);
                i.putExtra("zurag", imageId[position]);
                startActivity(i);
    

    in the singlelistitem class

     Intent i = getIntent();
            Intent i2 = getIntent();
            String text1 =i2.getStringExtra("str");
            texts.setText(text1);
    
    0 讨论(0)
提交回复
热议问题