File Chooser erkennt Kamera nicht

  • Antworten:3
Alexander R.
  • Forum-Beiträge: 23

22.07.2013, 15:33:23 via Website

Hallo Zusammen,

ich habe einen File Chooser in meine App eingefügt und es arbeitet soweit super.
Angezeigt wird zur Auswahl : Galerie, die App selbst, MP3 - Player und Musiktrack auswählen.
Problem ist das er nicht die Kamera und einen File Explorer anzeigt.

Weiß jemand wie ich diese einfüge?
Benutze derzeit ein Nexus 7 Tablet.


Grüße
Alexander

Antworten
Qpa
  • Forum-Beiträge: 75

22.07.2013, 16:01:42 via Website

Alexander R.

Benutze derzeit ein Nexus 7 Tablet.


Vielleicht weil das Nexus 7 Keine Kamera besitzt? :D
Oder du keine Berechtigungen für die Kamera hinzugefügt hast?

Antworten
Alexander R.
  • Forum-Beiträge: 23

22.07.2013, 16:10:31 via Website

Philipp K.
Alexander R.

Benutze derzeit ein Nexus 7 Tablet.


Vielleicht weil das Nexus 7 Keine Kamera besitzt? :D
Oder du keine Berechtigungen für die Kamera hinzugefügt hast?

Hallo Philipp,

naja das Nexus 7 hat eine Frontcamera,

und habe diese Rechte gegeben --->

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

habe zur Zeit auch noch ein Samsung Galaxy Tab zum testen was 2 Cameras hat (Vorne und Hinten).

Das schließe ich mal aus ..

— geändert am 22.07.2013, 16:10:57

Antworten
Alexander R.
  • Forum-Beiträge: 23

24.07.2013, 10:26:51 via Website

Hallo Zusammen,

also habe die Kamera nun in den File Chooser gekriegt... nun habe ich das Problem das er das gemachte Bild nicht auswählt.. hat einer eine Idee wieso?

Mein Code:

1public class Dateiupload extends Activity {
2
3 public WebView webView;
4 private ValueCallback<Uri> mUploadMessage;
5 private final static int FILECHOOSER_RESULTCODE = 1;
6 private static final int PICK_IMAGE = 0;
7
8 @Override
9 public void onCreate(Bundle savedInstanceState) {
10 super.onCreate(savedInstanceState);
11
12
13 WebView webView = (WebView)findViewById(R.id.webView1);
14 webView = new WebView(this);
15 setContentView(webView);
16 WebSettings settings = webView.getSettings();
17 settings.setBuiltInZoomControls(false);
18 settings.setUseWideViewPort(true);
19 settings.setSupportMultipleWindows(true);
20 settings.setJavaScriptCanOpenWindowsAutomatically(true);
21 settings.setLoadsImagesAutomatically(true);
22 settings.setLightTouchEnabled(true);
23 settings.setDomStorageEnabled(true);
24 settings.setLoadWithOverviewMode(true);
25 webView.getSettings().setJavaScriptEnabled(true);
26 webView.setWebViewClient(new WebViewClient());
27 webView.setWebChromeClient(new WebChromeClient() {
28 //The undocumented magic method override
29 //Eclipse will swear at you if you try to put @Override here
30 @SuppressWarnings("unused")
31 public void openFileChooser(ValueCallback<Uri> uploadMsg) {
32 Dateiupload.this.showAttachmentDialog(uploadMsg);
33 }
34
35 // For Android > 3.x
36 @SuppressWarnings("unused")
37 public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
38 Dateiupload.this.showAttachmentDialog(uploadMsg);
39 }
40
41 // For Android > 4.1
42 @SuppressWarnings("unused")
43 public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
44 Dateiupload.this.showAttachmentDialog(uploadMsg);
45 }
46 });
47
48 webView.loadUrl("http://**");
49
50 }
51
52 private void showAttachmentDialog(ValueCallback<Uri> uploadMsg) {
53 this.mUploadMessage = uploadMsg;
54
55 Intent i = new Intent(Intent.ACTION_GET_CONTENT);
56 i.addCategory(Intent.CATEGORY_OPENABLE);
57 i.setType("Image/*");
58 Intent takePhotoIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
59 String pickTitle = "Select or take a new Picture"; // Or get from strings.xml
60 Intent chooserIntent = Intent.createChooser(takePhotoIntent, pickTitle);
61 chooserIntent.putExtra ( Intent.EXTRA_INITIAL_INTENTS, new Intent[] { takePhotoIntent });
62 startActivityForResult(chooserIntent, PICK_IMAGE);
63 return;
64 }
65
66 @Override
67 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
68 if (requestCode == FILECHOOSER_RESULTCODE) {
69 if (null == this.mUploadMessage) {
70 return;
71 }
72 Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
73 this.mUploadMessage.onReceiveValue(result);
74 this.mUploadMessage = null;
75 }
76 }
77 }

Grüße
Alexander

— geändert am 24.07.2013, 10:27:16

Antworten