PDA

Ver la Versión Completa : [ CONSULTA ] error al actualizar a 4.4.2


pablogarcia013
17/12/13, 11:08:36
Buenas, he actualizado mi tablet y la app que he desarrollado me da problema en una cosilla.

Mi app es de poner imagenes y guardarlas, y lo de guardar es lo que no funciona, antes funcionaba perfectamente, pero al actualizarla me ha dado errores. en concreto me da este error: Java.lang.IllegalStateException: Could not execute method of the activity.
Y la linea de codigo en la que me da es esta:

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

Alguien sabe lo que puede pasar? probe en otros dispositivos y funciona perfectamente.

Muchas gracias!

neoadn
17/12/13, 11:10:04
Si pones todo el error. Tiene que poner en algún sitio. El nombre de la .class: y el número de linea.
Edito: puede ser por que te devuelva null en la dirección. Pon un try{}catch.. Y luego un log. De file

pablogarcia013
17/12/13, 11:22:45
try{
fos=new FileOutputStream(file);
bmpBase.compress(Bitmap.CompressFormat.JPEG, 100, fos);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

fos.flush();
fos.close();
fos=null;
if(guardarAlmacenamiento)
Toast.makeText(getApplicationContext(), "Ya tienes tu imagen ", Toast.LENGTH_SHORT).show();
}catch(IOException e){
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Error al guardar la imagen", Toast.LENGTH_SHORT).show();
}
ese es mi codigo
y este es el error entero

12-17 11:14:04.850: E/AndroidRuntime(5018): FATAL EXCEPTION: main
12-17 11:14:04.850: E/AndroidRuntime(5018): Process: com.comotu.collage.principal, PID: 5018
12-17 11:14:04.850: E/AndroidRuntime(5018): java.lang.IllegalStateException: Could not execute method of the activity
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.view.View$1.onClick(View.java:3823)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.view.View.performClick(View.java:4438)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.view.View$PerformClick.run(View.java:18422 )
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.os.Handler.handleCallback(Handler.java:733 )
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.os.Handler.dispatchMessage(Handler.java:95 )
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.os.Looper.loop(Looper.java:136)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.app.ActivityThread.main(ActivityThread.jav a:5017)
12-17 11:14:04.850: E/AndroidRuntime(5018): at java.lang.reflect.Method.invokeNative(Native Method)
12-17 11:14:04.850: E/AndroidRuntime(5018): at java.lang.reflect.Method.invoke(Method.java:515)
12-17 11:14:04.850: E/AndroidRuntime(5018): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:779)
12-17 11:14:04.850: E/AndroidRuntime(5018): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:595)
12-17 11:14:04.850: E/AndroidRuntime(5018): at dalvik.system.NativeStart.main(Native Method)
12-17 11:14:04.850: E/AndroidRuntime(5018): Caused by: java.lang.reflect.InvocationTargetException
12-17 11:14:04.850: E/AndroidRuntime(5018): at java.lang.reflect.Method.invokeNative(Native Method)
12-17 11:14:04.850: E/AndroidRuntime(5018): at java.lang.reflect.Method.invoke(Method.java:515)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.view.View$1.onClick(View.java:3818)
12-17 11:14:04.850: E/AndroidRuntime(5018): ... 11 more
12-17 11:14:04.850: E/AndroidRuntime(5018): Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED from pid=5018, uid=10105
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.os.Parcel.readException(Parcel.java:1465)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.os.Parcel.readException(Parcel.java:1419)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.app.ActivityManagerProxy.broadcastIntent(A ctivityManagerNative.java:2373)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.app.ContextImpl.sendBroadcast(ContextImpl. java:1127)
12-17 11:14:04.850: E/AndroidRuntime(5018): at android.content.ContextWrapper.sendBroadcast(Conte xtWrapper.java:365)
12-17 11:14:04.850: E/AndroidRuntime(5018): at com.comotu.collage.principal.ActividadPrincipal.Gu ardarImagenParaProyecto(ActividadPrincipal.java:60 9)
12-17 11:14:04.850: E/AndroidRuntime(5018): at com.comotu.collage.principal.ActividadPrincipal.on ClickGuardarProyecto(ActividadPrincipal.java:537)
12-17 11:14:04.850: E/AndroidRuntime(5018): ... 14 more

neoadn
17/12/13, 11:41:53
Me da la sensación de que puede ser algo de permisos en el manifest

Perdona pero no estoy en casa... Mirate esto
http://developer.android.com/guide/topics/security/permissions.html

Este te puede ayudar en algo:

http://www.vogella.com/articles/AndroidBroadcastReceiver/article.html

pablogarcia013
17/12/13, 12:24:09
Muchas gracias! voy a echarlo un vistazo y te comento