I need to pass a variable from (around)non-activity class to an nameget(android activity)class . Display the passed variable value in text view.. Please tel me what needs to do from this example. How to pass it to android activity
public class around(non-activity class)
{
String name = "arjun";
//how to pass this name value to an below activity
nameget nam = new nameget();
String new = nam.get(name);
}
public class nameget extends Activity(android activity class)
{
public String get(String name)
{
String got = name;
TextView t1 = (TextView)findViewById(R.id.textView1);
t1.setText(name);
}
}
Try this, declare your non activity class in you activity class.
public class around(non-activity class)
{
Public static String name;
name = "arjun";
//how to pass this name string to an below activity
}
public class nameget extends Activity(android activity class)
{
around ar = new around();
//declare non activity class here
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView t1 = (TextView)findViewById(R.id.textView1);
t1.setText(ar.name);
}
}
Try this
public class around(non-activity class)
{
public static String name = "arjun";
//how to pass this name string to an below activity
}
public class nameget extends Activity(android activity class)
{
TextView t1 = (TextView)findViewById(R.id.textView1);
//your class name around
t1.setText(around.name);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With