Result code code is -1 and returned intent is null in onActivityResult()
<p>I'm trying to initialize image picker dialog by this code: Intent chooserIntent = null;</p><pre><br /><code> List<Intent> intentList = new ArrayList<>();<br /><br /> Intent pickIntent = new Intent(Intent.ACTION_PICK,<br /> android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);<br /> Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);<br /> takePhotoIntent.putExtra("return-data", true);<br /> takePhotoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(getTempFile(context)));<br /> intentList = addIntentsToList(context, intentList, pickIntent);<br /> intentList = addIntentsToList(context, intentList, takePhotoIntent);<br /><br /> if (intentList.size() > 0) {<br /> chooserIntent = Intent.createChooser(intentList.remove(intentList.size() - 1), "");<br /> chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentList.toArray(new Parcelable[intentList.size()]));<br /> }<br /> startActivityForResult(chooserIntent, PICK_IMAGE_ID);<br /></code><br /></pre><p>But there</p><pre><br /><code>@Override<br /> protected void onActivityResult(int requestCode, int resultCode, Intent data) {<br /> switch(requestCode) {<br /> case PICK_IMAGE_ID:<br /> Bitmap bitmap = ImagePicker.getImageFromResult(this, resultCode, data);<br /> currentImageButton.setImageDrawable(new BitmapDrawable(bitmap));<br /> break;<br /> default:<br /> break;<br /> }<br /> super.onActivityResult(requestCode, resultCode, data);<br /> }<br /></code><br /></pre><p>Im getting null intent and -1 resultCode</p><p>I've added there permissions to manifest:</p><pre><br /><code><uses-permission android:name="android.permission.INTERNET" /><br /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /><br /><uses-permission android:name="android.permission.CAMERA" /><br /></code><br /></pre><p>Code works fine on most devices but fails on samsung duos. Where I wrong?</p><p><strong>UPD</strong></p><p><a href="http://ift.tt/1OPLVvl" rel="nofollow">activity</a></p><p><a href="http://ift.tt/1Oes8tp" rel="nofollow">image picker class</a></p><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34469652/result-code-code-is-1-and-returned-intent-is-null-in-onactivityresult">http://ift.tt/1YDEfGU</a></h2>
Nhận xét
Đăng nhận xét