Bild in Gallery öffnen...

  • Antworten:2
  • Bentwortet
Kullorki
  • Forum-Beiträge: 55

18.05.2011, 21:01:00 via Website

Hallo,
ich will, dass wenn ein Imageview angetippt wird, dieses bild mit dem standart Androidbild-programm geöffnent wird.(Also das wo man das Bild alleine sieht und man herumzoomen kann)
Methoden die ich probiert habe...:
1Intent intent = new Intent(Intent.ACTION_VIEW);
2 intent.setType("image/*"+kompletterbildPfad);
3 startActivity(intent);

Problem ist das die acitivity dann abschmiert...

105-18 18:51:33.440: ERROR/AndroidRuntime(11665): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.gallery/com.android.camera.ViewImage}: java.lang.NullPointerException


wenn ich es so probiere bekomme ich eine Activitynotfoundexception
1startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(KompletterBildPfad)));
105-18 18:55:19.740: ERROR/AndroidRuntime(11924): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=/mnt/sdcard/test/fotos/test.jpg }

Weiß da jemand wie das realisierbar ist, oder was ich falsch mache? Google hat mir da nicht wirklich weitergeholfen, entweder ich such nach dem falschen oder das hat noch niemand gemacht? auf Developer.android.com hab ich auch nicht wirklich was gefunden :/

mfg Kullorki

Antworten
Michael Haar
  • Forum-Beiträge: 55

18.05.2011, 23:39:47 via Website

Ich mach in meinen WebLiveWallpaper Widgets:

1Intent viewIntent = new Intent("android.intent.action.VIEW");
2viewIntent.setDataAndType(Uri.fromFile(new File(pathwithoutfileandextdir)), "image/*");
3startActivity(viewIntent);

Ich hatte da auch irgendein Problem aber ist schon länger her - meine Lösung war den Pfad erst ab sdcard anzugeben. Da es dann ging habe ich nicht weiter untersucht was das Problem ist und warum es dann ging.

— geändert am 18.05.2011, 23:42:05

Kullorki

Antworten
Kullorki
  • Forum-Beiträge: 55

19.05.2011, 18:08:59 via Website

cool das geht, Danke dir ! -_-

Antworten