Boa Tarde, no curso android II, estou na parte que você utiliza a camera, para tirar uma foto.
porém ele da esse erro no android monitor.
FATAL EXCEPTION: main
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=567, result=-1, data=null} to activity {com.dionisiofilho.agendaonline/com.dionisiofilho.agendaonline.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:3500)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3543)
at android.app.ActivityThread.access$1200(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:511)
at com.dionisiofilho.agendaonline.MainActivity.onActivityResult(MainActivity.java:255)
at android.app.Activity.dispatchActivityResult(Activity.java:5563)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3496)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3543)
at android.app.ActivityThread.access$1200(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
MainActivity
if (resultCode == Activity.RESULT_OK) {
if (requestCode == CODIGO_CAMERA) {
ImageView img_usuario = (ImageView) findViewById(R.id.img_usuario);
Bitmap bitmap = BitmapFactory.decodeFile(caminhofoto);
Bitmap bitmapreduzido = Bitmap.createScaledBitmap(bitmap, 300, 300, true);
img_usuario.setImageBitmap(bitmap);
img_usuario.setScaleType(ImageView.ScaleType.FIT_XY);
}
}