Below I have written the code for how to send data using Intent in Android from one Activity to another.
Intent i = new Intent(getActivity(), UploadWeldService.class);
i.putExtra("mCapturedImagePath", mCapturedImagePath);
i.putExtra("mCapturedImagePath1", mCapturedImagePath1);
i.putExtra("mCapturedImagePath2", mCapturedImagePath2);
i.putExtra("mCapturedImagePath3", mCapturedImagePath3);
i.putExtra("recordDataUrl", recordDataUrl);
i.putExtra("deviceName", deviceName);
i.putExtra("zipname",zipname);
i.putExtra("id", -1);
getActivity().startService(i);
Below is the code to retrive data that is being passed to the activity from another Activity using Intent
protected void onHandleIntent(Intent intent)
{
System.out.println("One upload start ");
String mCapturedImagePath = intent.getStringExtra("mCapturedImagePath");
mCapturedImagePath1 = intent.getStringExtra("mCapturedImagePath1");
mCapturedImagePath2 = intent.getStringExtra("mCapturedImagePath2");
mCapturedImagePath3 = intent.getStringExtra("mCapturedImagePath3");`
zipname = intent.getStringExtra("zipname");
String recordDataUrl = intent.getStringExtra("recordDataUrl");
String deviceName = intent.getStringExtra("deviceName");
int id = (intent.getIntExtra("id", -1));
}
0 Comment(s)