2009-08-10 3 views
1

J'essaie d'invoquer MMS « s Attacher une image Activity, voici mon code:Exception lors de l'appel MMS Attachons activité Image

  Intent intent2 = new Intent("com.android.mms.action.ATTACH_IMAGE"); 

      intent2.setType("image/*"); 
      intent2.putExtra(Intent.EXTRA_STREAM, mUri); 

      try { 
       startActivity(intent); 

      } catch (ActivityNotFoundException e) { 

      e.printStackTrace(System.err); 
      } 

Mais je reçois cette exception:

m.android.mms/com.android.mms.AttachImage}: java.lang.IllegalAccessException: access to class not allowed 
E/AndroidRuntime( 673):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219) 
E/AndroidRuntime( 673):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2332) 
E/AndroidRuntime( 673):  at android.app.ActivityThread.access$1800(ActivityThread.java:110) 
E/AndroidRuntime( 673):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1717) 
E/AndroidRuntime( 673):  at android.os.Handler.dispatchMessage(Handler.java:99) 
E/AndroidRuntime( 673):  at android.os.Looper.loop(Looper.java:123) 
E/AndroidRuntime( 673):  at android.app.ActivityThread.main(ActivityThread.java:4021) 
E/AndroidRuntime( 673):  at java.lang.reflect.Method.invokeNative(Native Method) 
E/AndroidRuntime( 673):  at java.lang.reflect.Method.invoke(Method.java:521) 
E/AndroidRuntime( 673):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 
E/AndroidRuntime( 673):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 
E/AndroidRuntime( 673):  at dalvik.system.NativeStart.main(Native Method) 
E/AndroidRuntime( 673): Caused by: java.lang.IllegalAccessException: access to class not allowed 
E/AndroidRuntime( 673):  at java.lang.Class.newInstanceImpl(Native Method) 
E/AndroidRuntime( 673):  at java.lang.Class.newInstance(Class.java:1472) 
E/AndroidRuntime( 673):  at android.app.Instrumentation.newActivity(Instrumentation.java:1097) 
E/AndroidRuntime( 673):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 

Pouvez-vous s'il vous plaît dire moi pourquoi? Merci.

Répondre

0

Ceci est probablement plus ce que vous essayez d'accomplir:

startActivity(
    new Intent(Intent.ACTION_SEND) 
     .setType("image/*") 
     .putExtra("sms_body", "hello there") 
     .putExtra(Intent.EXTRA_STREAM, Uri.parse("content://media/external/images/media/1") 
    ) 
); 

Tant que vous avez cassé net au moins une photo avec votre appareil photo, vous devriez être en mesure d'envoyer cette photo en utilisant ce code. Notez que ce code ne fonctionnera pas avec l'émulateur.

Questions connexes