Note that there are some explanatory texts on larger screens.

plurals
  1. POError in getting Android device ID
    primarykey
    data
    text
    <p>I am trying to retrieve the device ID of my adroid device in my android app. However, error exists and the program cannot launch after I added the following line in my program:</p> <pre><code>String ts = Context.TELEPHONY_SERVICE; TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(ts); </code></pre> <p>From the logcat, it says problems come fromt the second line:</p> <pre><code>07-18 11:28:47.453: E/AndroidRuntime(5528): FATAL EXCEPTION: main 07-18 11:28:47.453: E/AndroidRuntime(5528): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{android.reader/android.reader.Reader}: java.lang.NullPointerException 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.app.ActivityThread.access$600(ActivityThread.java:123) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.os.Handler.dispatchMessage(Handler.java:99) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.os.Looper.loop(Looper.java:137) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.app.ActivityThread.main(ActivityThread.java:4424) 07-18 11:28:47.453: E/AndroidRuntime(5528): at java.lang.reflect.Method.invokeNative(Native Method) 07-18 11:28:47.453: E/AndroidRuntime(5528): at java.lang.reflect.Method.invoke(Method.java:511) 07-18 11:28:47.453: E/AndroidRuntime(5528): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 07-18 11:28:47.453: E/AndroidRuntime(5528): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 07-18 11:28:47.453: E/AndroidRuntime(5528): at dalvik.system.NativeStart.main(Native Method) 07-18 11:28:47.453: E/AndroidRuntime(5528): Caused by: java.lang.NullPointerException 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.reader.Reader.&lt;init&gt;(Reader.java:51) 07-18 11:28:47.453: E/AndroidRuntime(5528): at java.lang.Class.newInstanceImpl(Native Method) 07-18 11:28:47.453: E/AndroidRuntime(5528): at java.lang.Class.newInstance(Class.java:1319) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 07-18 11:28:47.453: E/AndroidRuntime(5528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 07-18 11:28:47.453: E/AndroidRuntime(5528): ... 11 more </code></pre> <p>I think it is caused by the permission problem, but I have already added the following line in Manifest file:</p> <pre><code>&lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; </code></pre> <p>So, may I ask how can I tackle this problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload