Saturday, July 25, 2015

android: Send value (String or int) from one class to another class

Use this from class  send value
String value="Hellow ";
Intent ii = new Intent(this, SplashScreen.class); //SplashScreen is  receive class
ii.putExtra("pkgName", value);
ii.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivity(ii);

Use this to receive value class  
String getvalue;
try {
    getvalue= getIntent().getExtras().getString("pkgName");
} catch (Exception e) {
    System.out.println("Our Exception : " + e.getMessage());}

In the same way you can send int value.

No comments:

Post a Comment