Android accessing parent class values after starting an intent?
I'm starting an intent in an activity class TTWifi.java as follows
Intent i = new Intent(this, SocketClient.class);
startActivity(i);
Now how do i access the variables of TTWifi.class
from SocketClient.class
?
I believe there is a way to send values between them. I am very new to android, gue开发者_如何学Pythonss this is a very fundamental stuff :) Would really appreciate if someone can help me out in this...
Through this following code we can share the values to activities
Intent i=new Intent(FitnessGraph.this,Nami.class).putExtra("<StringName>"," String Value");
Use above code in parent activity and by using below line we can retrieve that value in child activity.Write this line in child activity
String s= getIntent().getStringExtra("<StringName>");
精彩评论