You can do it with your iPhone. Create a class where you can set data before starting a new action and access the same data from a new activity.
This will work as follows
- There are two actions, FirstActivity and SecondActivity.
- The data to send is the first and last name
therefore there will be one class in which you will have a variable for the data
public class DataTransporter{ public static String firstName; public static String lastName; }
In the first step, your code will be
DataTransporter.firstName = "abc"; DataTransporter.lastName = "xyz"; Intent intent = new Intent(FirstActivity.this,SecondActivity.class) startActivity(intent)
In the second step you can get this data
@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); String first = DataTransporter.firstName; String last = DataTransporter.lastName; }
You can delete data from the transporter class (if necessary) after retrieving.
source share