Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use Intent to send data from one Activity to another in Android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 94
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: