2017-09-01 1 views
1

ich teilen müssen, eine externen URL Bild zusammen mit Text, von einem WebView, aber aus irgendeinem Grunde, den ich Fehler auf jedem Picasso Überschreibung erhalten:Android - Gemeinsame Nutzung Bild-URL + Text mit Picasso

Bereits implementiert die Javascript-Schnittstelle in Android.

@JavascriptInterface 
    public void shareContent(String text, String imageURL){ 
     shareData(text, imageURL); 
    } 

Fehler erhalte ich:Method does not override method from its superclass.

public void shareData(String url) { 
    Picasso.with(getApplicationContext()).load(url).into(new AppLink.Target() { 
     @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { 
      Intent i = new Intent(Intent.ACTION_SEND); 
      i.setType("image/*"); 
      i.putExtra(Intent.EXTRA_STREAM, getLocalBitmapUri(bitmap)); 
      startActivity(Intent.createChooser(i, "Share Image")); 
     } 
     @Override public void onBitmapFailed(Drawable errorDrawable) { } 
     @Override public void onPrepareLoad(Drawable placeHolderDrawable) { } 
    }); 
} 

Und die Methode, um die lokale gespeicherte Bild zu erhalten

public Uri getLocalBitmapUri(Bitmap bmp) { 
    Uri bmpUri = null; 
    try { 
     File file = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".png"); 
     FileOutputStream out = new FileOutputStream(file); 
     bmp.compress(Bitmap.CompressFormat.PNG, 90, out); 
     out.close(); 
     bmpUri = Uri.fromFile(file); 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } 
    return bmpUri; 
} 
+0

suchen Wie Ist das kein Duplikat? https://stackoverflow.com/questions/23681177/picasso-load-image-from-filesystem –

+0

ich bin. Sie lesen eine Datei von der Festplatte und rufen dann eine Freigabe ab. Nicht sicher, warum Picasso überhaupt benötigt wird. –

+0

Für Leistung. – Isabelle

Antwort

0

Sieht aus wie Sie die Methoden von Picasso zu implementieren versucht, aber Sie tun es tatsächlich für die Applink.Target

into(new AppLink.Target() { 

ich glaube, du bist für dieses

into(new com.squareup.picasso.Target() { 
+0

Gerade heraus gefunden, danke Kumpel :) - Der Import war falsch, nach dem Import von Picasso, habe ich nur: neues Ziel() – Isabelle

Verwandte Themen