0

I am trying to build an android app. This is my first time working on an android app. I am facing some issues with my program in the android studio. I am trying to extract the username from the user input and send that data to the second activity. However, I am getting null in there.

SecondActivity.java

MainActivity.jva Part1

Part 2 MainActivity.java

Can anyone please help me out?

Emma
  • 27,428
  • 11
  • 44
  • 69

3 Answers3

0

In Main Activity your Key name is 'passdata1' , In receiving activity you are looking for 'KEY'. in second activity change it to 'passdata1'

SoftwareGuy
  • 1,121
  • 2
  • 11
  • 23
0

Use this

nam=intentextras.getString("passdata1")

insted of

nam=intentextras.getString("Key")

Explanation : When you send data from activity to an other activity with intent. You should remember to use same key to get the value in other activity.

You can check this link to understand more about that: How do I pass data between Activities in Android application?

Ali Zedan
  • 285
  • 3
  • 17
0

Replace this

 nam=intentextras.getString("KEY");

With this

nam=intentextras.getString("passdata1");
Priyanka
  • 1,791
  • 1
  • 7
  • 12