0
我想在Android的激活振動,但evrey時間我按下按鈕的應用程序崩潰.....認沽手機在振動的Android代碼
silet.setRingerMode(AudioManager.RINGER_MODE_VIBRATE)
也是我做的事情進口。 並宣佈:
public AudioManager silent;
的logcat:
07-13 22:06:17.956: E/AndroidRuntime(11925): FATAL EXCEPTION: main
07-13 22:06:17.956: E/AndroidRuntime(11925): java.lang.IllegalStateException: Could not execute method of the activity
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.view.View$1.onClick(View.java:2072)
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.view.View.performClick(View.java:2408)
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.view.View$PerformClick.run(View.java:8816)
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.os.Handler.handleCallback(Handler.java:587)
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.os.Handler.dispatchMessage(Handler.java:92)
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.os.Looper.loop(Looper.java:123)
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-13 22:06:17.956: E/AndroidRuntime(11925): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 22:06:17.956: E/AndroidRuntime(11925): at java.lang.reflect.Method.invoke(Method.java:521)
07-13 22:06:17.956: E/AndroidRuntime(11925): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-13 22:06:17.956: E/AndroidRuntime(11925): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-13 22:06:17.956: E/AndroidRuntime(11925): at dalvik.system.NativeStart.main(Native Method)
07-13 22:06:17.956: E/AndroidRuntime(11925): Caused by: java.lang.reflect.InvocationTargetException
07-13 22:06:17.956: E/AndroidRuntime(11925): at com.android.hello.MainActivity.click(MainActivity.java:25)
07-13 22:06:17.956: E/AndroidRuntime(11925): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 22:06:17.956: E/AndroidRuntime(11925): at java.lang.reflect.Method.invoke(Method.java:521)
07-13 22:06:17.956: E/AndroidRuntime(11925): at android.view.View$1.onClick(View.java:2067)
07-13 22:06:17.956: E/AndroidRuntime(11925): ... 11 more
07-13 22:06:17.956: E/AndroidRuntime(11925): Caused by: java.lang.NullPointerException
如果發生崩潰,請發佈LogCat錯誤以及實際的代碼方法(不只是一行)。 – Eric 2012-07-13 19:00:14
感謝您的logcat,但它是不完整的...請張貼整個logcat,因爲它出現問題的根本原因沒有被切斷。 – Sam 2012-07-13 19:08:06