Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(getPackageManager() != null && chooserIntent.resolveActivity(getPackageManager()) != null)
- startActivityForResult(chooserIntent, Constants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
- public static Intent openImageIntent(String directory, String imageName, PackageManager pkm, String Text) {
- // Determine Uri of camera image to save.
- final File root = new File(Environment.getExternalStorageDirectory() + File.separator + directory + File.separator);
- root.mkdirs();
- final String fname = imageName + ".jpg";
- final File sdImageMainDirectory = new File(root, fname);
- Uri imageUri = Uri.fromFile(sdImageMainDirectory);
- // Camera.
- final List<Intent> cameraIntents = new ArrayList<Intent>();
- final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
- //final PackageManager packageManager = pkm;
- final List<ResolveInfo> listCam = pkm.queryIntentActivities(captureIntent, 0);
- for (ResolveInfo res : listCam) {
- if (res != null && res.activityInfo != null) {
- final String packageName = res.activityInfo.packageName;
- final Intent intent = new Intent(captureIntent);
- intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
- intent.setPackage(packageName);
- intent.putExtra("camareImage", imageUri);
- cameraIntents.add(intent);
- }
- }
- // Filesystem.
- final Intent galleryIntent = new Intent();
- galleryIntent.setType("image/*");
- galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
- // Chooser of filesystem options.
- final Intent chooserIntent = Intent.createChooser(galleryIntent, Text);
- // Add the camera options.
- chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{}));
- return chooserIntent;
- }
- String filePath = null;
- String selectedImagePath;
- String fileManagerPath;
- if (data != null) {
- Uri selectedImage = data.getData();
- getContentResolver().notifyChange(selectedImage, null);
- if (selectedImage != null) {
- fileManagerPath = selectedImage.getPath();
- selectedImagePath = BitmapUtil.getPath(selectedImage,
- getContentResolver());
- if (selectedImagePath != null)
- filePath = selectedImagePath;
- else if (fileManagerPath != null)
- filePath = fileManagerPath;
- else if (getApplicationContext() != null)
- Toast.makeText(getApplicationContext(),
- "Unknown file path", Toast.LENGTH_LONG).show();
- if (filePath != null) {
- if (requestCode == Constants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
- ImageView profileImageView = ((ImageView) findViewById(R.id.user_controls_userimage_imageview));
- if (profileImageView.getDrawable() != null) {
- Bitmap bitmap = ((BitmapDrawable) profileImageView
- .getDrawable()).getBitmap();
- bitmap = BitmapUtil.getBitmap(bitmap, filePath);
- BitmapUtil.saveBitmapIntoProject(
- EnvironmentObjects.currentPhoneUser
- .getUserid() + "_image",
- bitmap, getApplicationContext()
- );
- loadPicture(bitmap);
- }
- } else {
- Bitmap bm = BitmapUtil.getBitmap(null, filePath);
- addCard(bm);
- }
- }
- }
- }
- }
- 11-26 10:30:25.241: E/mm-camera(196): Failed to open sensor1 port
- 11-26 10:30:25.289: E/mm-camera-intf(183): mm_stream_get_v4l2_fmt: Unknown fmt=78
- 11-26 10:30:25.295: E/mm-camera(196): mct_pipeline_get_stream: stream not found in the list
- 11-26 10:30:25.334: E/mm-camera-img(196): Face Album FILE EXISTS
- 11-26 10:30:25.463: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
- 11-26 10:30:25.463: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
- 11-26 10:30:25.468: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
- 11-26 10:30:25.468: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
- 11-26 10:30:25.472: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
- 11-26 10:30:25.472: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
- 11-26 10:30:25.478: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
- 11-26 10:30:25.478: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
- 11-26 10:30:25.490: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
- 11-26 10:30:25.490: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
- 11-26 10:30:25.523: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
- 11-26 10:30:25.523: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
- 11-26 10:30:25.603: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
- 11-26 10:30:25.603: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
- 11-26 10:30:25.646: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
- 11-26 10:30:25.646: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
- 11-26 10:30:31.798: E/mm-camera-intf(183): mm_channel_fsm_fn_stopped: invalid state (1) for evt (8)
- 11-26 10:30:31.834: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
- 11-26 10:30:31.834: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
- 11-26 10:30:31.876: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
- 11-26 10:30:31.876: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
- 11-26 10:30:32.010: E/mm-camera(196): pproc_module_process_event:1386 invalid control event type 12
- 11-26 10:30:32.122: E/QCamera3Channel(183): static void qcamera::QCamera3PicChannel::jpegEvtHandle(jpeg_job_status_t, uint32_t, uint32_t, mm_jpeg_output_t*, void*): Meta frame was NULL
- 11-26 10:30:33.256: E/mm-camera-intf(183): mm_camera_poll_thread_del_poll_fd: invalid handler 54784 (0)
- 11-26 10:30:33.381: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 55555
- 11-26 10:30:33.384: E/mm-camera-intf(183): mm_camera_poll_thread_del_poll_fd: invalid handler 55296 (0)
- 11-26 10:30:33.476: E/mm-camera(196): isp_unlink_sink_port: E
- 11-26 10:30:33.476: E/mm-camera-img(196): faceproc_save_album:774] Error No album
- 11-26 10:30:33.476: E/mm-camera-img(196): faceproc_comp_eng_destroy: Album save failed -1
- 11-26 10:30:33.477: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 54529
- 11-26 10:30:33.477: E/QCamera3Channel(183): virtual int32_t qcamera::QCamera3PicChannel::stop(): Attempt to stop inactive channel
- 11-26 10:30:33.478: E/mm-camera(196): isp_unlink_sink_port: E
- 11-26 10:30:33.482: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 55042
- 11-26 10:30:33.512: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 54016
- 11-26 10:30:33.516: E/mm-camera(196): mct_pipeline_get_stream: no children
- 11-26 10:30:33.516: E/mm-camera(196): mct_pipeline_process_set:1440: Couldn't find stream
- 11-26 10:30:33.681: E/NsdService(741): Unhandled { when=0 what=393240 target=com.android.internal.util.StateMachine$SmHandler }
- 11-26 10:30:33.720: A/ContentService(741): Content Service Crash
- 11-26 10:30:33.720: A/ContentService(741): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getAuthority()' on a null object reference
- 11-26 10:30:33.720: A/ContentService(741): at com.android.server.content.ContentService.notifyChange(ContentService.java:283)
- 11-26 10:30:33.720: A/ContentService(741): at android.content.IContentService$Stub.onTransact(IContentService.java:95)
- 11-26 10:30:33.720: A/ContentService(741): at com.android.server.content.ContentService.onTransact(ContentService.java:141)
- 11-26 10:30:33.720: A/ContentService(741): at android.os.Binder.execTransact(Binder.java:446)
- 11-26 10:30:33.731: E/AndroidRuntime(618): FATAL EXCEPTION: main
- 11-26 10:30:33.731: E/AndroidRuntime(618): Process: com.caribesid.csidsaludapp, PID: 618
- 11-26 10:30:33.731: E/AndroidRuntime(618): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=411, result=-1, data=Intent { act=inline-data (has extras) }} to activity {com.caribesid.csidsaludapp/com.caribesid.csidsaludapp.HomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getAuthority()' on a null object reference
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.deliverResults(ActivityThread.java:3539)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3582)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.access$1300(ActivityThread.java:144)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Handler.dispatchMessage(Handler.java:102)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Looper.loop(Looper.java:135)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.main(ActivityThread.java:5221)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at java.lang.reflect.Method.invoke(Native Method)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at java.lang.reflect.Method.invoke(Method.java:372)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
- 11-26 10:30:33.731: E/AndroidRuntime(618): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getAuthority()' on a null object reference
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Parcel.readException(Parcel.java:1546)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Parcel.readException(Parcel.java:1493)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.IContentService$Stub$Proxy.notifyChange(IContentService.java:733)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.ContentResolver.notifyChange(ContentResolver.java:1638)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.ContentResolver.notifyChange(ContentResolver.java:1627)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.ContentResolver.notifyChange(ContentResolver.java:1607)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at com.caribesid.csidsaludapp.HomeActivity.onActivityResult(HomeActivity.java:421)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.Activity.dispatchActivityResult(Activity.java:6135)
- 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.deliverResults(ActivityThread.java:3535)
- 11-26 10:30:33.731: E/AndroidRuntime(618): ... 10 more
- 11-26 10:30:33.733: E/AndroidRuntime(30170): FATAL EXCEPTION: main
- 11-26 10:30:33.733: E/AndroidRuntime(30170): Process: com.android.documentsui, PID: 30170
- 11-26 10:30:33.733: E/AndroidRuntime(30170): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getAuthority()' on a null object reference
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at com.android.documentsui.RootsCache$RootsChangedObserver.onChange(RootsCache.java:95)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.database.ContentObserver.onChange(ContentObserver.java:145)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:216)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.os.Handler.handleCallback(Handler.java:739)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.os.Handler.dispatchMessage(Handler.java:95)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.os.Looper.loop(Looper.java:135)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.app.ActivityThread.main(ActivityThread.java:5221)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at java.lang.reflect.Method.invoke(Native Method)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at java.lang.reflect.Method.invoke(Method.java:372)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
- 11-26 10:30:33.733: E/AndroidRuntime(30170): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement