How to start an activity which calls a method from a different class?



I have an activity which transfer a string datatype to another activity which then uses that string and calls a method from another class which returns a string. I want to use that method to display the string in the current activity.


So visually it goes (activity 1) -- string--> (activity 2). Activity 2 uses that string to call a method in a different java class which returns a type string which i want to display on the screen along with a few buttons.


So some pseudo code:


say The method in a different java class is:



public static String getStringexample(String n) {
return "hello" + " " + n;
}


and my activity class is:



public class manage extends Activity {
protected void onCreate(bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContainerView(R.layout.activity_manage);

Intent intent = getIntent();
String example = intent.getExtras().getString("intentid");


i'm lost after this..not sure how to use what i got from the intent to display it on the screen in java code.


No comments:

Post a Comment