KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
First thing I know this is repeated question but I don't have problem in capturing image from gallery or camera. I created on dummy project to check my code here it's working fine But when I used same code in my project & here it's not working even I didn't get any error as soon as I start activity for result it get cancelled but still I can see images from gallery & I can capture image from camera. When I checked logcat I found following warning don't know why it's coming & how I can fix this thing W/NetworkConnectivityListener(2399): onReceived() called with CONNECTED and Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x10000000 (has extras) } Edit:-- Added Code @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.camera: //define the file-name to save photo taken by Camera activity String fileName = "new-photo-name.jpg"; //create parameters for Intent with filename ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, fileName); values.put(MediaStore.Images.Media.DESCRIPTION,"Image capture by camera"); //imageUri is the current activity attribute, define and save it for later usage (also in onSaveInstanceState) imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); //create new Intent Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, PICK_Camera_IMAGE); return true; case R.id.gallery: try { Intent gintent = new Intent(); gintent.setType("image/*"); gintent.setAction(Intent.ACTIO
Tags (comma-separated)
Save Edits
Cancel