hello,
I'm a beginner at developing android applications,and I'm stuck at a place trying to send data from mainActivity to another activity using intents. and right before putting the variable in the intent.putExtra() method ,I've checked if the variable contains data using println statement and it displayed the content in that variable but right after getting the data from the intent into the next activity and it is showing null when checked for contents in that variable using println statement.
this is my code :
mainActivity:
second Activity:
please help me resolve this problem
thank you,
I'm a beginner at developing android applications,and I'm stuck at a place trying to send data from mainActivity to another activity using intents. and right before putting the variable in the intent.putExtra() method ,I've checked if the variable contains data using println statement and it displayed the content in that variable but right after getting the data from the intent into the next activity and it is showing null when checked for contents in that variable using println statement.
this is my code :
mainActivity:
Java:
if (propertyInfo.name.contains("shopName")) {
String shopName = propertyInfo.getValue().toString();
System.out.println("shopName to be sent in intent : " + shopName); //value is being displayed here.
intent.putExtra("shopName",shopName);
if (propertyInfo.name.contains("shopNo")) {
String shopNo = propertyInfo.getValue().toString();
System.out.println(" shopNo to be sent in intent :" + shopNo);// value is being displayed here.
intent.putExtra("shopNo", shopNo);
}
Java:
Intent intent = getIntent();
String shopNameS = intent.getStringExtra("shopName");
System.out.println("shopName is : " +shopNameS); // null is being displayed
shopName.setText("(" + shopNameS + ")");
String shopNumberS = intent.getStringExtra("shopNo");
System.out.println("shop number is : " + shopNumberS); // null is being diaplayed
shopNumber.setText(shopNumberS);
please help me resolve this problem
thank you,
Last edited by a moderator:
