public static void main(String args[]) {
myMethod(); // i am calling static method from main()
}
.
public static ? myMethod(){
I know this is late but I thought it'd be helpful to someone who'll come searching for an answer to this. You can use a Bundle
to return multiple datatype values without creating another method. I tried it and worked perfectly.
In Your MainActivity where you call the method:
Bundle myBundle = method();
String myString = myBundle.getString("myS");
String myInt = myBundle.getInt("myI");
Method:
public Bundle method() {
mBundle = new Bundle();
String typicalString = "This is String";
Int typicalInt = 1;
mBundle.putString("myS", typicalString);
mBundle.putInt("myI", typicalInt);
return mBundle;
}
P.S: I'm not sure if it's OK to implement a Bundle like this, but for me, it worked out perfectly.