Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
How to reset data in createChooser intent

When user do share image and press cancel the createchooser keep using information from last call ,even when i he does new share still old informations stored there. How to reset intent data when user cancel sharing ??

i am using this code for sharing

 private void shareIt() {
    uri = Uri.fromFile(imagePath);
    Intent sharingIntent = new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("image/*");
    String shareBody = "try this app";
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "social share app");
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
    sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
    startActivity(Intent.createChooser(sharingIntent, "share by .."));

}
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(path);

sharingIntent.setType("image/*");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));

use bove code

put this code to manifest

<intent-filter>
   <action android:name="android.intent.action.SEND" />
   <category android:name="android.intent.category.DEFAULT" />
   <data android:mimeType="image/*" />
</intent-filter>
over 4 years ago · Santiago Trujillo Report

0

You are not update your ImagePath, So all the time intent show same Image for share, update imagePath before call shareIt() method

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!