2016-07-07 14 views
0

Wie erkennen, aus denen (any) extern app (oder packagname) Daten geteilt wurden:Android - Intent-Sharing

Via Austausch von Bild/Daten (Absicht) von einer anderen App zu meinem app (Aktivität),

+0

Bitte erklären Sie mehr, damit die Leute verstehen, was Sie wirklich sagen – Jas

+0

AFAIK, das wird nicht unterstützt. – CommonsWare

+0

Keine Problemumgehung? – FadyAro

Antwort

0
private void shareImage() { 
    Intent share = new Intent(Intent.ACTION_SEND); 

    // If you want to share a png image only, you can do: 
    // setType("image/png"); OR for jpeg: setType("image/jpeg"); 
    share.setType("image/*"); 

    // Make sure you put example png image named myImage.png in your 
    // directory 
    String imagePath = Environment.getExternalStorageDirectory() 
      + "/myImage.png"; 

    File imageFileToShare = new File(imagePath); 

    Uri uri = Uri.fromFile(imageFileToShare); 
    share.putExtra(Intent.EXTRA_STREAM, uri); 

    startActivity(Intent.createChooser(share, "Share Image!")); 
} 
Verwandte Themen