Android Intent.getStringExtra() returns null

后端 未结 1 1304
迷失自我
迷失自我 2020-12-03 09:53

This is how strings are being added to Extras:

Intent i = new Intent();
i.putExtra(\"Name\", edt_name.getText());
i.putExtra(\"Description\", edt_desc.getTex         


        
1条回答
  •  有刺的猬
    2020-12-03 10:24

    When you insert your Extras trying adding .toString()

    i.putExtra("Name", edt_name.getText().toString());
    

    You are seeing the CharSequence value in there but you need to convert it to a String to call getStringExtra(). Obviously, just do this for the Strings. You see the correct value for your int because that is done correctly

    0 讨论(0)
提交回复
热议问题