Notification Android 3.0 - android

My application always crashes when I try to create a Notification, only crashes on Android 3.0.
03-05 21:23:00.774: ERROR/ActivityManager(66): Activity Manager Crash
03-05 21:23:00.774: ERROR/ActivityManager(66): java.lang.IllegalArgumentException: Null intent at index 0
03-05 21:23:00.774: ERROR/ActivityManager(66): at com.android.server.am.ActivityManagerService.getIntentSender(ActivityManagerService.java:3907)
03-05 21:23:00.774: ERROR/ActivityManager(66): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:799)
03-05 21:23:00.774: ERROR/ActivityManager(66): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1516)
03-05 21:23:00.774: ERROR/ActivityManager(66): at android.os.Binder.execTransact(Binder.java:320)
03-05 21:23:00.774: ERROR/ActivityManager(66): at dalvik.system.NativeStart.run(Native Method)
03-05 21:23:00.784: WARN/dalvikvm(458): threadid=9: thread exiting with uncaught exception (group=0x40014760)
03-05 21:23:00.814: ERROR/AndroidRuntime(458): FATAL EXCEPTION: Thread-10
03-05 21:23:00.814: ERROR/AndroidRuntime(458): java.lang.IllegalArgumentException: Null intent at index 0
03-05 21:23:00.814: ERROR/AndroidRuntime(458): at android.os.Parcel.readException(Parcel.java:1326)
03-05 21:23:00.814: ERROR/AndroidRuntime(458): at android.os.Parcel.readException(Parcel.java:1276)
03-05 21:23:00.814: ERROR/AndroidRuntime(458): at android.app.ActivityManagerProxy.getIntentSender(ActivityManagerNative.java:2356)
03-05 21:23:00.814: ERROR/AndroidRuntime(458): at android.app.PendingIntent.getActivity(PendingIntent.java:195)
03-05 21:23:00.814: ERROR/AndroidRuntime(458): at com.perlapps.myantivirus.scanmethodes.UpdateDatabase$1.run(UpdateDatabase.java:244)
Has anybody got an idea how to fix it???
Edit: Works perfectly on 1.5 to 2.3
NotificationManager meinNM = (NotificationManager) oContext.getSystemService(Context.NOTIFICATION_SERVICE);
Notification meinNotofication = new Notification(R.drawable.icon,"HELLO",System.currentTimeMillis());
PendingIntent pendingIntent = PendingIntent.getActivity(oContext.getApplicationContext(),0, null, 0);
meinNotofication.setLatestEventInfo(oContext.getApplicationContext(),"HELLO","HELLO",pendingIntent);
meinNM.notify(97, meinNotofication);

Use a valid PendingIntent. Yours is invalid -- null is not a valid third parameter to getActivity(). Also, get rid of getApplicationContext() -- oContext is a Context and is all you need.

Related

Todo list using SQLite [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I followed a tutorial from google to add todo list to my app. I have databasehelper class and todolist fragment class and also todolist model . Unfortunately when I run the app it stops working. I dont have any error and I'm not sure which part im doing wrong
LogCat
03-05 19:01:57.367: I/BLAH(26508): the project is com.projecttracker.model.TheProject#41ee07a8
03-05 19:01:57.377: I/PROJECT_ITEM_FRAG(26508): getAllProjects add project one with id 1
03-05 19:01:59.229: E/SQLiteLog(26508): (1) near "FROMTodo": syntax error
03-05 19:01:59.229: D/AndroidRuntime(26508): Shutting down VM
03-05 19:01:59.229: W/dalvikvm(26508): threadid=1: thread exiting with uncaught exception (group=0x415e7ba8)
03-05 19:01:59.229: E/AndroidRuntime(26508): FATAL EXCEPTION: main
03-05 19:01:59.229: E/AndroidRuntime(26508): Process: com.projecttracker, PID: 26508
03-05 19:01:59.229: E/AndroidRuntime(26508): android.database.sqlite.SQLiteException: near "FROMTodo": syntax error (code 1): , while compiling: SELECT * FROMTodo
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
03-05 19:01:59.229: E/AndroidRuntime(26508): at com.projecttracker.model.DatabaseHelper.getAllTodolists(DatabaseHelper.java:112)
03-05 19:01:59.229: E/AndroidRuntime(26508): at com.projecttracker.TodolistFragment.onCreateView(TodolistFragment.java:46)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.os.Handler.handleCallback(Handler.java:733)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.os.Handler.dispatchMessage(Handler.java:95)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.os.Looper.loop(Looper.java:136)
03-05 19:01:59.229: E/AndroidRuntime(26508): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-05 19:01:59.229: E/AndroidRuntime(26508): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 19:01:59.229: E/AndroidRuntime(26508): at java.lang.reflect.Method.invoke(Method.java:515)
03-05 19:01:59.229: E/AndroidRuntime(26508): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-05 19:01:59.229: E/AndroidRuntime(26508): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-05 19:01:59.229: E/AndroidRuntime(26508): at dalvik.system.NativeStart.main(Native Method)
03-05 19:02:01.261: I/Process(26508): Sending signal. PID: 26508 SIG: 9
03-05 19:11:18.544: I/Adreno-EGL(27649): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
03-05 19:11:18.574: D/OpenGLRenderer(27649): Enabling debug mode 0
03-05 19:11:18.624: D/dalvikvm(27649): GC_FOR_ALLOC freed 154K, 2% free 9359K/9544K, paused 15ms, total 15ms
03-05 19:11:25.361: I/BLAH(27649): the project is com.projecttracker.model.TheProject#41ede950
03-05 19:11:25.371: I/PROJECT_ITEM_FRAG(27649): getAllProjects add project one with id 1
03-05 19:11:32.658: E/SQLiteLog(27649): (1) near "FROMTodo": syntax error
03-05 19:11:32.658: D/AndroidRuntime(27649): Shutting down VM
03-05 19:11:32.658: W/dalvikvm(27649): threadid=1: thread exiting with uncaught exception (group=0x415e7ba8)
03-05 19:11:32.668: E/AndroidRuntime(27649): FATAL EXCEPTION: main
03-05 19:11:32.668: E/AndroidRuntime(27649): Process: com.projecttracker, PID: 27649
03-05 19:11:32.668: E/AndroidRuntime(27649): android.database.sqlite.SQLiteException: near "FROMTodo": syntax error (code 1): , while compiling: SELECT * FROMTodo
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
03-05 19:11:32.668: E/AndroidRuntime(27649): at com.projecttracker.model.DatabaseHelper.getAllTodolists(DatabaseHelper.java:112)
03-05 19:11:32.668: E/AndroidRuntime(27649): at com.projecttracker.TodolistFragment.onCreateView(TodolistFragment.java:41)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.os.Handler.handleCallback(Handler.java:733)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.os.Handler.dispatchMessage(Handler.java:95)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.os.Looper.loop(Looper.java:136)
03-05 19:11:32.668: E/AndroidRuntime(27649): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-05 19:11:32.668: E/AndroidRuntime(27649): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 19:11:32.668: E/AndroidRuntime(27649): at java.lang.reflect.Method.invoke(Method.java:515)
03-05 19:11:32.668: E/AndroidRuntime(27649): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-05 19:11:32.668: E/AndroidRuntime(27649): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-05 19:11:32.668: E/AndroidRuntime(27649): at dalvik.system.NativeStart.main(Native Method)
It's a syntax error, FROMTodo. You need a space between FROM and Todo.
The error says
near "FROMTodo": syntax error
Add a space before the closing quote:
String selectQuery = "SELECT * FROM "+ todoTable
^
|-- Space here

Crash when using Google Play Game Services (Unity3d in Android)

I have a problem. I am developing a game in Unity3d which uses the official Facebook SDK and NerdGPG for Google Play Game Services. However, there is an annoying bug:
WHen I want to see the Achievements or Leaderboards, it opnes the UI, but AFTER I CLOSE the UI, then the game crashes. The Logcat tells the following:
03-05 00:09:54.325: E/AndroidRuntime(10810): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9002, result=0, data=null} to activity {com.radioactivewasp.flyingwasp/com.facebook.unity.FBUnityPlayerActivity}: java.lang.NullPointerException
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.app.ActivityThread.deliverResults(ActivityThread.java:3182)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3225)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.app.ActivityThread.access$1100(ActivityThread.java:140)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1275)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.os.Handler.dispatchMessage(Handler.java:99)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.os.Looper.loop(Looper.java:137)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.app.ActivityThread.main(ActivityThread.java:4898)
03-05 00:09:54.325: E/AndroidRuntime(10810): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 00:09:54.325: E/AndroidRuntime(10810): at java.lang.reflect.Method.invoke(Method.java:511)
03-05 00:09:54.325: E/AndroidRuntime(10810): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
03-05 00:09:54.325: E/AndroidRuntime(10810): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
03-05 00:09:54.325: E/AndroidRuntime(10810): at dalvik.system.NativeStart.main(Native Method)
03-05 00:09:54.325: E/AndroidRuntime(10810): Caused by: java.lang.NullPointerException
03-05 00:09:54.325: E/AndroidRuntime(10810): at com.facebook.unity.FBUnityPlayerActivity.onActivityResult(FBUnityPlayerActivity.java:15)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.app.Activity.dispatchActivityResult(Activity.java:5390)
03-05 00:09:54.325: E/AndroidRuntime(10810): at android.app.ActivityThread.deliverResults(ActivityThread.java:3178)
Anybody know what could be the solution?
It looks like your Facebook plugin Activity doesn't know how to handle the onActivityResult() callback when you use the RC_UNUSED(9002) requestID.So I imagine you would want to modify your Facebook Player activity such that the NerdGPG plugin handles the callback.

Android how to avoid NullPointException

I have NullPointException in my code, and this is the reason why my app is crashing...
I'm new in Android development, so can you please help me to avoid this Null exception?
here is some code, where i think is this error:
#Override
public void onClick(View v) {
btn_skip = (Button) findViewById(R.id.btn_skip);
// get data
String email_txt = email.getEditableText().toString();
String confirme_email = confirm_email.getEditableText().toString();
//get IMEI
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
imei = telephonyManager.getDeviceId();
if (v == btn_skip)
{
sendPostRequest(null, null, imei);
}
//if email is not valid then show errors
else if (!checkEmail(email.getText().toString()) && v == btn_get_access)
{
email_error.setVisibility(View.VISIBLE);
email.requestFocus();
//Toast.makeText(getBaseContext(), "lkdjfgkdjg", Toast.LENGTH_LONG).show();
}
//else if (!confirme_email.equals(email_txt) && v == btn_get_access)
else if (!email_txt.equals(confirme_email))
{
email_confirm_error.setVisibility(View.VISIBLE);
confirm_email.requestFocus();
}
else
{
email_error.setVisibility(View.GONE);
email_confirm_error.setVisibility(View.GONE);
sendPostRequest(email_txt, confirme_email, imei);
}
}
so how i get this error:
in my app i have 2 activities, and i can switch them by buttons, first button send some data which i get from user on the server (all inputs are filled with data), with the second button i can skip the input filling and go to the second screen(all inputs are empty);
from the 2nd screen i can go back to the first screen without any data(and when i press this back button, i have this null exception).
Please help me with this error, because i can't imagine how to avoid it...
UPD LOGCAT
03-05 10:01:07.214: W/ActivityThread(12011): Application com.vladimir.expert_suise is waiting for the debugger on port 8100...
03-05 10:01:07.224: I/System.out(12011): Sending WAIT chunk
03-05 10:01:07.224: I/dalvikvm(12011): Debugger is active
03-05 10:01:07.424: I/System.out(12011): Debugger has connected
03-05 10:01:07.424: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:07.624: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:07.814: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:08.014: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:08.215: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:08.415: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:08.615: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:08.815: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:09.015: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:09.226: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:09.426: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:09.626: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:09.826: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:10.026: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:10.226: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:10.427: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:10.627: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:10.827: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:11.027: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:11.227: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:11.428: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:11.628: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:11.828: I/System.out(12011): waiting for debugger to settle...
03-05 10:01:12.028: I/System.out(12011): debugger has settled (1463)
03-05 10:01:13.620: D/libEGL(12011): loaded /system/lib/egl/libGLES_android.so
03-05 10:01:13.800: D/libEGL(12011): loaded /system/lib/egl/libEGL_adreno200.so
03-05 10:01:14.080: D/libEGL(12011): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
03-05 10:01:14.080: D/libEGL(12011): loaded /system/lib/egl/libGLESv2_adreno200.so
03-05 10:01:14.401: I/Adreno200-EGLSUB(12011): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:14.561: D/memalloc(12011): ashmem: Mapped buffer base:0x520a0000 size:1536000 fd:61
03-05 10:01:14.591: D/OpenGLRenderer(12011): Enabling debug mode 0
03-05 10:01:15.141: D/OpenGLRenderer(12011): has fontRender patch
03-05 10:01:15.171: D/OpenGLRenderer(12011): has fontRender patch
03-05 10:01:15.211: D/OpenGLRenderer(12011): has fontRender patch
03-05 10:01:15.281: D/memalloc(12011): ashmem: Mapped buffer base:0x5251a000 size:1536000 fd:64
03-05 10:01:15.962: D/memalloc(12011): ashmem: Mapped buffer base:0x52691000 size:1536000 fd:67
03-05 10:01:19.996: I/Adreno200-EGLSUB(12011): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:20.006: D/memalloc(12011): ashmem: Mapped buffer base:0x52b08000 size:1536000 fd:76
03-05 10:01:20.316: D/memalloc(12011): ashmem: Mapped buffer base:0x52cff000 size:1536000 fd:79
03-05 10:01:20.647: I/Adreno200-EGLSUB(12011): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:20.657: D/memalloc(12011): ashmem: Mapped buffer base:0x52f76000 size:1536000 fd:82
03-05 10:01:20.797: D/memalloc(12011): ashmem: Mapped buffer base:0x530ed000 size:1536000 fd:88
03-05 10:01:20.957: D/memalloc(12011): ashmem: Mapped buffer base:0x53264000 size:1536000 fd:91
03-05 10:01:21.157: D/memalloc(12011): ashmem: Mapped buffer base:0x533db000 size:1536000 fd:94
03-05 10:01:21.177: D/OpenGLRenderer(12011): Flushing caches (mode 0)
03-05 10:01:21.207: D/OpenGLRenderer(12011): Flushing caches (mode 0)
03-05 10:01:22.999: I/Adreno200-EGLSUB(12011): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:23.019: D/memalloc(12011): ashmem: Mapped buffer base:0x5251a000 size:1536000 fd:63
03-05 10:01:23.309: D/memalloc(12011): ashmem: Mapped buffer base:0x52691000 size:1536000 fd:69
03-05 10:01:23.419: I/Adreno200-EGLSUB(12011): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:23.429: D/memalloc(12011): ashmem: Mapped buffer base:0x52a08000 size:1536000 fd:79
03-05 10:01:23.610: D/memalloc(12011): ashmem: Mapped buffer base:0x52cff000 size:1536000 fd:88
03-05 10:01:23.660: D/memalloc(12011): ashmem: Mapped buffer base:0x530ed000 size:1536000 fd:97
03-05 10:01:23.830: D/memalloc(12011): ashmem: Mapped buffer base:0x53552000 size:1536000 fd:100
03-05 10:01:23.850: D/OpenGLRenderer(12011): Flushing caches (mode 0)
03-05 10:01:23.870: D/OpenGLRenderer(12011): Flushing caches (mode 0)
03-05 10:01:25.291: I/Adreno200-EGLSUB(12011): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:25.301: D/memalloc(12011): ashmem: Mapped buffer base:0x5261a000 size:1536000 fd:63
03-05 10:01:25.451: D/memalloc(12011): ashmem: Mapped buffer base:0x52e76000 size:1536000 fd:82
03-05 10:01:25.481: D/OpenGLRenderer(12011): Flushing caches (mode 0)
03-05 10:01:25.882: D/memalloc(12011): ashmem: Mapped buffer base:0x52a08000 size:1536000 fd:79
03-05 10:01:27.603: D/AndroidRuntime(12011): Shutting down VM
03-05 10:01:27.603: W/dalvikvm(12011): threadid=1: thread exiting with uncaught exception (group=0x40ad9228)
03-05 10:01:27.633: E/AndroidRuntime(12011): FATAL EXCEPTION: main
03-05 10:01:27.633: E/AndroidRuntime(12011): java.lang.NullPointerException
03-05 10:01:27.633: E/AndroidRuntime(12011): at com.vladimir.expert_suise.FirstScreen.onClick(FirstScreen.java:174)
03-05 10:01:27.633: E/AndroidRuntime(12011): at android.view.View.performClick(View.java:3549)
03-05 10:01:27.633: E/AndroidRuntime(12011): at android.view.View$PerformClick.run(View.java:14400)
03-05 10:01:27.633: E/AndroidRuntime(12011): at android.os.Handler.handleCallback(Handler.java:605)
03-05 10:01:27.633: E/AndroidRuntime(12011): at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 10:01:27.633: E/AndroidRuntime(12011): at android.os.Looper.loop(Looper.java:154)
03-05 10:01:27.633: E/AndroidRuntime(12011): at android.app.ActivityThread.main(ActivityThread.java:4945)
03-05 10:01:27.633: E/AndroidRuntime(12011): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 10:01:27.633: E/AndroidRuntime(12011): at java.lang.reflect.Method.invoke(Method.java:511)
03-05 10:01:27.633: E/AndroidRuntime(12011): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-05 10:01:27.633: E/AndroidRuntime(12011): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-05 10:01:27.633: E/AndroidRuntime(12011): at dalvik.system.NativeStart.main(Native Method)
03-05 10:01:30.747: D/Process(12011): killProcess, pid=12011
03-05 10:01:30.757: D/Process(12011): dalvik.system.VMStack.getThreadStackTrace(Native Method)
03-05 10:01:30.757: D/Process(12011): java.lang.Thread.getStackTrace(Thread.java:599)
03-05 10:01:30.757: D/Process(12011): android.os.Process.killProcess(Process.java:788)
03-05 10:01:30.757: D/Process(12011): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:104)
03-05 10:01:30.757: D/Process(12011): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
03-05 10:01:30.757: D/Process(12011): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
03-05 10:01:30.757: D/Process(12011): dalvik.system.NativeStart.main(Native Method)
03-05 10:01:30.757: I/Process(12011): Sending signal. PID: 12011 SIG: 9
03-05 10:01:31.307: D/libEGL(12216): loaded /system/lib/egl/libGLES_android.so
03-05 10:01:31.307: D/libEGL(12216): loaded /system/lib/egl/libEGL_adreno200.so
03-05 10:01:31.307: D/libEGL(12216): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
03-05 10:01:31.317: D/libEGL(12216): loaded /system/lib/egl/libGLESv2_adreno200.so
03-05 10:01:31.337: I/Adreno200-EGLSUB(12216): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:31.357: D/memalloc(12216): ashmem: Mapped buffer base:0x51fa0000 size:1536000 fd:61
03-05 10:01:31.367: D/OpenGLRenderer(12216): Enabling debug mode 0
03-05 10:01:31.417: D/OpenGLRenderer(12216): has fontRender patch
03-05 10:01:31.437: D/OpenGLRenderer(12216): has fontRender patch
03-05 10:01:31.467: D/OpenGLRenderer(12216): has fontRender patch
03-05 10:01:31.507: D/memalloc(12216): ashmem: Mapped buffer base:0x5241a000 size:1536000 fd:64
03-05 10:01:31.918: D/memalloc(12216): ashmem: Mapped buffer base:0x52691000 size:1536000 fd:67
03-05 10:01:47.313: D/AndroidRuntime(12216): Shutting down VM
03-05 10:01:47.313: W/dalvikvm(12216): threadid=1: thread exiting with uncaught exception (group=0x40ad9228)
03-05 10:01:47.313: E/AndroidRuntime(12216): FATAL EXCEPTION: main
03-05 10:01:47.313: E/AndroidRuntime(12216): java.lang.NullPointerException
03-05 10:01:47.313: E/AndroidRuntime(12216): at com.vladimir.expert_suise.FirstScreen.onClick(FirstScreen.java:174)
03-05 10:01:47.313: E/AndroidRuntime(12216): at android.view.View.performClick(View.java:3549)
03-05 10:01:47.313: E/AndroidRuntime(12216): at android.view.View$PerformClick.run(View.java:14400)
03-05 10:01:47.313: E/AndroidRuntime(12216): at android.os.Handler.handleCallback(Handler.java:605)
03-05 10:01:47.313: E/AndroidRuntime(12216): at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 10:01:47.313: E/AndroidRuntime(12216): at android.os.Looper.loop(Looper.java:154)
03-05 10:01:47.313: E/AndroidRuntime(12216): at android.app.ActivityThread.main(ActivityThread.java:4945)
03-05 10:01:47.313: E/AndroidRuntime(12216): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 10:01:47.313: E/AndroidRuntime(12216): at java.lang.reflect.Method.invoke(Method.java:511)
03-05 10:01:47.313: E/AndroidRuntime(12216): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-05 10:01:47.313: E/AndroidRuntime(12216): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-05 10:01:47.313: E/AndroidRuntime(12216): at dalvik.system.NativeStart.main(Native Method)
03-05 10:01:49.064: D/Process(12216): killProcess, pid=12216
03-05 10:01:49.064: D/Process(12216): dalvik.system.VMStack.getThreadStackTrace(Native Method)
03-05 10:01:49.064: D/Process(12216): java.lang.Thread.getStackTrace(Thread.java:599)
03-05 10:01:49.064: D/Process(12216): android.os.Process.killProcess(Process.java:788)
03-05 10:01:49.064: D/Process(12216): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:104)
03-05 10:01:49.064: D/Process(12216): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
03-05 10:01:49.064: D/Process(12216): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
03-05 10:01:49.064: D/Process(12216): dalvik.system.NativeStart.main(Native Method)
03-05 10:01:49.064: I/Process(12216): Sending signal. PID: 12216 SIG: 9
03-05 10:01:49.545: D/libEGL(12233): loaded /system/lib/egl/libGLES_android.so
03-05 10:01:49.555: D/libEGL(12233): loaded /system/lib/egl/libEGL_adreno200.so
03-05 10:01:49.555: D/libEGL(12233): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
03-05 10:01:49.555: D/libEGL(12233): loaded /system/lib/egl/libGLESv2_adreno200.so
03-05 10:01:49.575: I/Adreno200-EGLSUB(12233): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:01:49.585: D/memalloc(12233): ashmem: Mapped buffer base:0x51fb9000 size:1536000 fd:62
03-05 10:01:49.585: D/OpenGLRenderer(12233): Enabling debug mode 0
03-05 10:01:49.645: D/OpenGLRenderer(12233): has fontRender patch
03-05 10:01:49.665: D/OpenGLRenderer(12233): has fontRender patch
03-05 10:01:49.685: D/OpenGLRenderer(12233): has fontRender patch
03-05 10:01:49.755: D/memalloc(12233): ashmem: Mapped buffer base:0x52466000 size:1536000 fd:65
03-05 10:01:50.135: D/memalloc(12233): ashmem: Mapped buffer base:0x526dd000 size:1536000 fd:68
03-05 10:01:51.347: D/OpenGLRenderer(12233): Flushing caches (mode 0)
03-05 10:01:51.447: W/IInputConnectionWrapper(12233): showStatusIcon on inactive InputConnection
03-05 10:01:51.447: W/IInputConnectionWrapper(12233): InputConnection = com.android.internal.widget.EditableInputConnection#40dd02e8, active client = false
03-05 10:01:51.647: D/OpenGLRenderer(12233): Flushing caches (mode 1)
03-05 10:02:00.155: D/OpenGLRenderer(12233): Flushing caches (mode 1)
03-05 10:02:08.814: D/OpenGLRenderer(12233): Flushing caches (mode 1)
03-05 10:02:08.994: D/OpenGLRenderer(12233): Flushing caches (mode 2)
03-05 10:02:32.427: W/ActivityThread(12468): Application com.vladimir.expert_suise is waiting for the debugger on port 8100...
03-05 10:02:32.447: I/System.out(12468): Sending WAIT chunk
03-05 10:02:32.447: I/dalvikvm(12468): Debugger is active
03-05 10:02:32.647: I/System.out(12468): Debugger has connected
03-05 10:02:32.647: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:32.847: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:33.047: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:33.247: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:33.448: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:33.648: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:33.848: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:34.048: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:34.248: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:34.449: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:34.649: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:34.859: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:35.049: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:35.249: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:35.450: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:35.650: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:35.850: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:36.050: I/System.out(12468): waiting for debugger to settle...
03-05 10:02:36.250: I/System.out(12468): debugger has settled (1356)
03-05 10:02:37.502: D/libEGL(12468): loaded /system/lib/egl/libGLES_android.so
03-05 10:02:37.532: D/libEGL(12468): loaded /system/lib/egl/libEGL_adreno200.so
03-05 10:02:37.582: D/libEGL(12468): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
03-05 10:02:37.582: D/libEGL(12468): loaded /system/lib/egl/libGLESv2_adreno200.so
03-05 10:02:37.652: I/Adreno200-EGLSUB(12468): <ConfigWindowMatch:2078>: Format RGBA_8888.
03-05 10:02:37.692: D/memalloc(12468): ashmem: Mapped buffer base:0x520a0000 size:1536000 fd:61
03-05 10:02:37.702: D/OpenGLRenderer(12468): Enabling debug mode 0
03-05 10:02:37.902: D/OpenGLRenderer(12468): has fontRender patch
03-05 10:02:37.922: D/OpenGLRenderer(12468): has fontRender patch
03-05 10:02:37.952: D/OpenGLRenderer(12468): has fontRender patch
03-05 10:02:38.002: D/memalloc(12468): ashmem: Mapped buffer base:0x5251a000 size:1536000 fd:64
03-05 10:02:38.312: D/memalloc(12468): ashmem: Mapped buffer base:0x52691000 size:1536000 fd:67
03-05 10:03:07.731: D/dalvikvm(12468): Debugger has detached; object registry had 776 entries
03-05 10:03:07.731: D/AndroidRuntime(12468): Shutting down VM
03-05 10:03:07.731: W/dalvikvm(12468): threadid=1: thread exiting with uncaught exception (group=0x40ad9228)
03-05 10:03:07.731: E/AndroidRuntime(12468): FATAL EXCEPTION: main
03-05 10:03:07.731: E/AndroidRuntime(12468): java.lang.NullPointerException
03-05 10:03:07.731: E/AndroidRuntime(12468): at com.vladimir.expert_suise.FirstScreen.onClick(FirstScreen.java:174)
03-05 10:03:07.731: E/AndroidRuntime(12468): at android.view.View.performClick(View.java:3549)
03-05 10:03:07.731: E/AndroidRuntime(12468): at android.view.View$PerformClick.run(View.java:14400)
03-05 10:03:07.731: E/AndroidRuntime(12468): at android.os.Handler.handleCallback(Handler.java:605)
03-05 10:03:07.731: E/AndroidRuntime(12468): at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 10:03:07.731: E/AndroidRuntime(12468): at android.os.Looper.loop(Looper.java:154)
03-05 10:03:07.731: E/AndroidRuntime(12468): at android.app.ActivityThread.main(ActivityThread.java:4945)
03-05 10:03:07.731: E/AndroidRuntime(12468): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 10:03:07.731: E/AndroidRuntime(12468): at java.lang.reflect.Method.invoke(Method.java:511)
03-05 10:03:07.731: E/AndroidRuntime(12468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-05 10:03:07.731: E/AndroidRuntime(12468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-05 10:03:07.731: E/AndroidRuntime(12468): at dalvik.system.NativeStart.main(Native Method)
try to remove Context like this:
TelephonyManager tManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
String IMEI = tManager.getDeviceId();
taken from Using Telephony Manager in android to find IMEI number
Have you taken permission in manifest file??
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

error when retrieving a record from the data base?

I'm trying to retrieve a name stred in SQLite table, despite the database has 11 or more records, when I try to retrieve any name from the stored records, The App. Crashs.
Java code:
OnClickListener btn_NavaigateListsner = new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (!btn_Save.isEnabled()) {
int c = mpoh.getCurrentRowNumber();
Toast.makeText(getBaseContext(), ""+mpoh.getMP_Name(0), Toast.LENGTH_SHORT).show();
Bundle bundle = new Bundle();
//bundle.putString("name", mpoh.getMP_Name(c));
//bundle.putDouble("lat", mpoh.getMP_Lat(c));
//bundle.putDouble("lng", mpoh.getMP_Lng(c));
//bundle.putString("date", mpoh.getMP_Date(c));
//bundle.putString("time", mpoh.getMP_Time(c));
intent01 = new Intent(MPData.this, MPInfo.class);
intent01.putExtras(bundle);
startActivity(intent01);
}// End of If
}
};
Method that retrieves the stored name:
public String getMP_Name(long id) {
SQLiteDatabase db = this.getReadableDatabase();
SQLiteCursor c = (SQLiteCursor) db.rawQuery("SELECT name FROM MPData WHERE "+
BaseColumns._ID+" = "+
Long.toString(id) +" AND name IS NOT NULL ", null);
c.moveToFirst();
String r = c.getString(0);
c.close();
db.close();
return r;
}
some of LogCat's output:
03-05 12:16:48.288: E/AndroidRuntime(973): FATAL EXCEPTION: main
03-05 12:16:48.288: E/AndroidRuntime(973): android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
03-05 12:16:48.288: E/AndroidRuntime(973): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
03-05 12:16:48.288: E/AndroidRuntime(973): at com.androidbook.MP.MP_DB.getMP_Name(MP_DB.java:45)
03-05 12:16:48.288: E/AndroidRuntime(973): at com.androidbook.MP.MPData$1.onClick(MPData.java:57)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.view.View.performClick(View.java:2485)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.view.View$PerformClick.run(View.java:9080)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.os.Handler.handleCallback(Handler.java:587)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.os.Looper.loop(Looper.java:130)
03-05 12:16:48.288: E/AndroidRuntime(973): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-05 12:16:48.288: E/AndroidRuntime(973): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 12:16:48.288: E/AndroidRuntime(973): at java.lang.reflect.Method.invoke(Method.java:507)
03-05 12:16:48.288: E/AndroidRuntime(973): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-05 12:16:48.288: E/AndroidRuntime(973): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-05 12:16:48.288: E/AndroidRuntime(973): at dalvik.system.NativeStart.main(Native Method)
03-05 12:32:19.897: E/AndroidRuntime(1022): FATAL EXCEPTION: main
03-05 12:32:19.897: E/AndroidRuntime(1022): android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
03-05 12:32:19.897: E/AndroidRuntime(1022): at com.androidbook.MP.MP_DB.getMP_Name(MP_DB.java:45)
03-05 12:32:19.897: E/AndroidRuntime(1022): at com.androidbook.MP.MPData$1.onClick(MPData.java:57)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.view.View.performClick(View.java:2485)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.view.View$PerformClick.run(View.java:9080)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.os.Handler.handleCallback(Handler.java:587)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.os.Looper.loop(Looper.java:130)
03-05 12:32:19.897: E/AndroidRuntime(1022): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-05 12:32:19.897: E/AndroidRuntime(1022): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 12:32:19.897: E/AndroidRuntime(1022): at java.lang.reflect.Method.invoke(Method.java:507)
03-05 12:32:19.897: E/AndroidRuntime(1022): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-05 12:32:19.897: E/AndroidRuntime(1022): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-05 12:32:19.897: E/AndroidRuntime(1022): at dalvik.system.NativeStart.main(Native Method)
03-05 12:39:24.627: E/AndroidRuntime(1093): FATAL EXCEPTION: main
03-05 12:39:24.627: E/AndroidRuntime(1093): android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
03-05 12:39:24.627: E/AndroidRuntime(1093): at com.androidbook.MP.MP_DB.getMP_Name(MP_DB.java:45)
03-05 12:39:24.627: E/AndroidRuntime(1093): at com.androidbook.MP.MPData$1.onClick(MPData.java:57)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.View.performClick(View.java:2485)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.View.onKeyUp(View.java:4257)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.widget.TextView.onKeyUp(TextView.java:4587)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.KeyEvent.dispatch(KeyEvent.java:1280)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.View.dispatchKeyEvent(View.java:3855)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
03-05 12:39:24.627: E/AndroidRuntime(1093): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1687)
03-05 12:39:24.627: E/AndroidRuntime(1093): at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1120)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.app.Activity.dispatchKeyEvent(Activity.java:2073)
03-05 12:39:24.627: E/AndroidRuntime(1093): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1663)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2560)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2535)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.os.Handler.dispatchMessage(Handler.java:99)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.os.Looper.loop(Looper.java:130)
03-05 12:39:24.627: E/AndroidRuntime(1093): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-05 12:39:24.627: E/AndroidRuntime(1093): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 12:39:24.627: E/AndroidRuntime(1093): at java.lang.reflect.Method.invoke(Method.java:507)
03-05 12:39:24.627: E/AndroidRuntime(1093): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-05 12:39:24.627: E/AndroidRuntime(1093): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-05 12:39:24.627: E/AndroidRuntime(1093): at dalvik.system.NativeStart.main(Native Method)
The code looks fine to me. Are you 100% sure you have an entry in your DB with an _id corresponding to 0?
If you call getMP_Name with an invalid _id then the exception will get raised as you posted it.
You should check for this case as follows:
if (c.getCount()==0) return "";
// rest of code
But I wouldn't do it like this anyway because your current implementation of getMP_XXX is very inefficient because you hit the database for each field and each row. You should minimise your number of queries and then iterate over the resulting cursor.
Look at the following line :
String r = c.getString(0);
You are not safe checking your cursor and just assuming a result was recieved.
Check you SQL query and add a safe check for making sure your cursor has retrieved results.

Application built for API 8 does not work with API 7 - what goes wrong?

Hey guys
I simply want to downgrade my api level 8 to 7 so that i can run the
application both on 2.2 and 2.1 devices.
The application is running perfectly fine on 2.2 and is having problem
working on 2.1
I have done changes in manifest.xml and project -> properties
My application basically uses sax parser , facebook sdk , twitter
connect
This is the log cat:
03-05 12:32:13.553: WARN/dalvikvm(232): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
03-05 12:32:13.563: ERROR/AndroidRuntime(232): Uncaught handler: thread main exiting due to uncaught exception
03-05 12:32:13.623: ERROR/AndroidRuntime(232): java.lang.NullPointerException
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at com.test.activity.MyActivity$FetchTopMusic.onPostExecute(MusicScreen.java:161)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at com.test.activity.MyActivity$FetchTopMusic.onPostExecute(MusicScreen.java:1)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at android.os.AsyncTask.finish(AsyncTask.java:417)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at android.os.AsyncTask.access$300(AsyncTask.java:127)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at android.os.Handler.dispatchMessage(Handler.java:99)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at android.os.Looper.loop(Looper.java:123)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at java.lang.reflect.Method.invoke(Method.java:521)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-05 12:32:13.623: ERROR/AndroidRuntime(232): at dalvik.system.NativeStart.main(Native Method)
And i get this message after the splash screen.
Music Screen has async task which is calling various classes in various packages for parsing the xml content.
Is this a problem in xml parser??
The line 161 is :-
for (int i = 0; i < tracks.size(); i++)
Where tracks is an arrayList and all this code is working fine in 2.2
Have you checked in the default properties and set the target to 7? Then check whether it is possible or not.
Let me know...

Categories

Resources