Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.08 KB | None | 0 0
  1. if(getPackageManager() != null && chooserIntent.resolveActivity(getPackageManager()) != null)
  2. startActivityForResult(chooserIntent, Constants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
  3.  
  4. public static Intent openImageIntent(String directory, String imageName, PackageManager pkm, String Text) {
  5. // Determine Uri of camera image to save.
  6. final File root = new File(Environment.getExternalStorageDirectory() + File.separator + directory + File.separator);
  7.  
  8. root.mkdirs();
  9.  
  10. final String fname = imageName + ".jpg";
  11. final File sdImageMainDirectory = new File(root, fname);
  12.  
  13. Uri imageUri = Uri.fromFile(sdImageMainDirectory);
  14.  
  15. // Camera.
  16. final List<Intent> cameraIntents = new ArrayList<Intent>();
  17. final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  18. //final PackageManager packageManager = pkm;
  19. final List<ResolveInfo> listCam = pkm.queryIntentActivities(captureIntent, 0);
  20.  
  21. for (ResolveInfo res : listCam) {
  22. if (res != null && res.activityInfo != null) {
  23. final String packageName = res.activityInfo.packageName;
  24. final Intent intent = new Intent(captureIntent);
  25.  
  26. intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
  27. intent.setPackage(packageName);
  28. intent.putExtra("camareImage", imageUri);
  29.  
  30. cameraIntents.add(intent);
  31. }
  32. }
  33.  
  34. // Filesystem.
  35. final Intent galleryIntent = new Intent();
  36.  
  37. galleryIntent.setType("image/*");
  38. galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
  39.  
  40. // Chooser of filesystem options.
  41.  
  42. final Intent chooserIntent = Intent.createChooser(galleryIntent, Text);
  43.  
  44. // Add the camera options.
  45. chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{}));
  46.  
  47. return chooserIntent;
  48. }
  49.  
  50. String filePath = null;
  51. String selectedImagePath;
  52. String fileManagerPath;
  53.  
  54. if (data != null) {
  55. Uri selectedImage = data.getData();
  56. getContentResolver().notifyChange(selectedImage, null);
  57.  
  58. if (selectedImage != null) {
  59. fileManagerPath = selectedImage.getPath();
  60. selectedImagePath = BitmapUtil.getPath(selectedImage,
  61. getContentResolver());
  62.  
  63. if (selectedImagePath != null)
  64. filePath = selectedImagePath;
  65. else if (fileManagerPath != null)
  66. filePath = fileManagerPath;
  67. else if (getApplicationContext() != null)
  68. Toast.makeText(getApplicationContext(),
  69. "Unknown file path", Toast.LENGTH_LONG).show();
  70.  
  71. if (filePath != null) {
  72. if (requestCode == Constants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
  73. ImageView profileImageView = ((ImageView) findViewById(R.id.user_controls_userimage_imageview));
  74.  
  75. if (profileImageView.getDrawable() != null) {
  76. Bitmap bitmap = ((BitmapDrawable) profileImageView
  77. .getDrawable()).getBitmap();
  78.  
  79. bitmap = BitmapUtil.getBitmap(bitmap, filePath);
  80.  
  81. BitmapUtil.saveBitmapIntoProject(
  82. EnvironmentObjects.currentPhoneUser
  83. .getUserid() + "_image",
  84. bitmap, getApplicationContext()
  85. );
  86.  
  87. loadPicture(bitmap);
  88. }
  89. } else {
  90. Bitmap bm = BitmapUtil.getBitmap(null, filePath);
  91.  
  92. addCard(bm);
  93. }
  94. }
  95. }
  96. }
  97. }
  98.  
  99. 11-26 10:30:25.241: E/mm-camera(196): Failed to open sensor1 port
  100. 11-26 10:30:25.289: E/mm-camera-intf(183): mm_stream_get_v4l2_fmt: Unknown fmt=78
  101. 11-26 10:30:25.295: E/mm-camera(196): mct_pipeline_get_stream: stream not found in the list
  102. 11-26 10:30:25.334: E/mm-camera-img(196): Face Album FILE EXISTS
  103. 11-26 10:30:25.463: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
  104. 11-26 10:30:25.463: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
  105. 11-26 10:30:25.468: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
  106. 11-26 10:30:25.468: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
  107. 11-26 10:30:25.472: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
  108. 11-26 10:30:25.472: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
  109. 11-26 10:30:25.478: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
  110. 11-26 10:30:25.478: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
  111. 11-26 10:30:25.490: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
  112. 11-26 10:30:25.490: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
  113. 11-26 10:30:25.523: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
  114. 11-26 10:30:25.523: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
  115. 11-26 10:30:25.603: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
  116. 11-26 10:30:25.603: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
  117. 11-26 10:30:25.646: E/mm-camera(196): cpp_module_process_downstream_event:1061, Update buf queue: APPEND
  118. 11-26 10:30:25.646: E/mm-camera(196): port_isp_mct_ctrl_cmd: error in isp_update_buf_info, identity = 0x20002
  119. 11-26 10:30:31.798: E/mm-camera-intf(183): mm_channel_fsm_fn_stopped: invalid state (1) for evt (8)
  120. 11-26 10:30:31.834: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
  121. 11-26 10:30:31.834: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
  122. 11-26 10:30:31.876: E/mm-camera(196): gamma_config: size mismatch, expecting = 9468, received = 14608
  123. 11-26 10:30:31.876: E/mm-camera(196): isp_pix_pipeline_set_col_tone_mode: module GAMMA config failed
  124. 11-26 10:30:32.010: E/mm-camera(196): pproc_module_process_event:1386 invalid control event type 12
  125. 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
  126. 11-26 10:30:33.256: E/mm-camera-intf(183): mm_camera_poll_thread_del_poll_fd: invalid handler 54784 (0)
  127. 11-26 10:30:33.381: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 55555
  128. 11-26 10:30:33.384: E/mm-camera-intf(183): mm_camera_poll_thread_del_poll_fd: invalid handler 55296 (0)
  129. 11-26 10:30:33.476: E/mm-camera(196): isp_unlink_sink_port: E
  130. 11-26 10:30:33.476: E/mm-camera-img(196): faceproc_save_album:774] Error No album
  131. 11-26 10:30:33.476: E/mm-camera-img(196): faceproc_comp_eng_destroy: Album save failed -1
  132. 11-26 10:30:33.477: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 54529
  133. 11-26 10:30:33.477: E/QCamera3Channel(183): virtual int32_t qcamera::QCamera3PicChannel::stop(): Attempt to stop inactive channel
  134. 11-26 10:30:33.478: E/mm-camera(196): isp_unlink_sink_port: E
  135. 11-26 10:30:33.482: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 55042
  136. 11-26 10:30:33.512: E/QCamera3Channel(183): virtual qcamera::QCamera3Channel::~QCamera3Channel(): deleting channel 54016
  137. 11-26 10:30:33.516: E/mm-camera(196): mct_pipeline_get_stream: no children
  138. 11-26 10:30:33.516: E/mm-camera(196): mct_pipeline_process_set:1440: Couldn't find stream
  139. 11-26 10:30:33.681: E/NsdService(741): Unhandled { when=0 what=393240 target=com.android.internal.util.StateMachine$SmHandler }
  140. 11-26 10:30:33.720: A/ContentService(741): Content Service Crash
  141. 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
  142. 11-26 10:30:33.720: A/ContentService(741): at com.android.server.content.ContentService.notifyChange(ContentService.java:283)
  143. 11-26 10:30:33.720: A/ContentService(741): at android.content.IContentService$Stub.onTransact(IContentService.java:95)
  144. 11-26 10:30:33.720: A/ContentService(741): at com.android.server.content.ContentService.onTransact(ContentService.java:141)
  145. 11-26 10:30:33.720: A/ContentService(741): at android.os.Binder.execTransact(Binder.java:446)
  146. 11-26 10:30:33.731: E/AndroidRuntime(618): FATAL EXCEPTION: main
  147. 11-26 10:30:33.731: E/AndroidRuntime(618): Process: com.caribesid.csidsaludapp, PID: 618
  148. 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
  149. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.deliverResults(ActivityThread.java:3539)
  150. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3582)
  151. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.access$1300(ActivityThread.java:144)
  152. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)
  153. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Handler.dispatchMessage(Handler.java:102)
  154. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Looper.loop(Looper.java:135)
  155. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.main(ActivityThread.java:5221)
  156. 11-26 10:30:33.731: E/AndroidRuntime(618): at java.lang.reflect.Method.invoke(Native Method)
  157. 11-26 10:30:33.731: E/AndroidRuntime(618): at java.lang.reflect.Method.invoke(Method.java:372)
  158. 11-26 10:30:33.731: E/AndroidRuntime(618): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
  159. 11-26 10:30:33.731: E/AndroidRuntime(618): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
  160. 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
  161. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Parcel.readException(Parcel.java:1546)
  162. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.os.Parcel.readException(Parcel.java:1493)
  163. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.IContentService$Stub$Proxy.notifyChange(IContentService.java:733)
  164. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.ContentResolver.notifyChange(ContentResolver.java:1638)
  165. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.ContentResolver.notifyChange(ContentResolver.java:1627)
  166. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.content.ContentResolver.notifyChange(ContentResolver.java:1607)
  167. 11-26 10:30:33.731: E/AndroidRuntime(618): at com.caribesid.csidsaludapp.HomeActivity.onActivityResult(HomeActivity.java:421)
  168. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.Activity.dispatchActivityResult(Activity.java:6135)
  169. 11-26 10:30:33.731: E/AndroidRuntime(618): at android.app.ActivityThread.deliverResults(ActivityThread.java:3535)
  170. 11-26 10:30:33.731: E/AndroidRuntime(618): ... 10 more
  171. 11-26 10:30:33.733: E/AndroidRuntime(30170): FATAL EXCEPTION: main
  172. 11-26 10:30:33.733: E/AndroidRuntime(30170): Process: com.android.documentsui, PID: 30170
  173. 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
  174. 11-26 10:30:33.733: E/AndroidRuntime(30170): at com.android.documentsui.RootsCache$RootsChangedObserver.onChange(RootsCache.java:95)
  175. 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.database.ContentObserver.onChange(ContentObserver.java:145)
  176. 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:216)
  177. 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.os.Handler.handleCallback(Handler.java:739)
  178. 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.os.Handler.dispatchMessage(Handler.java:95)
  179. 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.os.Looper.loop(Looper.java:135)
  180. 11-26 10:30:33.733: E/AndroidRuntime(30170): at android.app.ActivityThread.main(ActivityThread.java:5221)
  181. 11-26 10:30:33.733: E/AndroidRuntime(30170): at java.lang.reflect.Method.invoke(Native Method)
  182. 11-26 10:30:33.733: E/AndroidRuntime(30170): at java.lang.reflect.Method.invoke(Method.java:372)
  183. 11-26 10:30:33.733: E/AndroidRuntime(30170): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
  184. 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