I retrieve the device ID in my main activity by doing:
String UDID = System.getString(this.getContentResolver(), System.ANDROID_ID);
Later in my code I start a new Activity in which I need the UDID as well, but when I run the same line of code it crashes:
01-01 12:20:54.793: ERROR/AndroidRuntime(868): FATAL EXCEPTION: main
01-01 12:20:54.793: ERROR/AndroidRuntime(868): java.lang.NullPointerException
01-01 12:20:54.793: ERROR/AndroidRuntime(868): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:91)
I understand that it has to do something with the context, but cant figure out how to fix this. Of course I could do putExtra, but I guess there must be a better way.