I am using the code from this tutorial javapapers email app
I am getting these errors
03-05 01:33:25.649: E/SendMailTask(1926): null
03-05 01:33:25.649: E/SendMailTask(1926): javax.mail.AuthenticationFailedException
03-05 01:33:25.649: E/SendMailTask(1926): at javax.mail.Service.connect(Service.java:319)
03-05 01:33:25.649: E/SendMailTask(1926): at javax.mail.Service.connect(Service.java:169)
03-05 01:33:25.649: E/SendMailTask(1926): at com.javapapers.android.androidjavamail.GMail.sendEmail(GMail.java:82)
03-05 01:33:25.649: E/SendMailTask(1926): at com.javapapers.android.androidjavamail.SendMailTask.doInBackground(SendMailTask.java:39)
03-05 01:33:25.649: E/SendMailTask(1926): at android.os.AsyncTask$2.call(AsyncTask.java:288)
03-05 01:33:25.649: E/SendMailTask(1926): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-05 01:33:25.649: E/SendMailTask(1926): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-05 01:33:25.649: E/SendMailTask(1926): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-05 01:33:25.649: E/SendMailTask(1926): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-05 01:33:25.649: E/SendMailTask(1926): at java.lang.Thread.run(Thread.java:841)
and this
03-05 01:33:25.799: E/AndroidRuntime(1926): FATAL EXCEPTION: main
03-05 01:33:25.799: E/AndroidRuntime(1926): Process: com.javapapers.android.androidjavamail, PID: 1926
03-05 01:33:25.799: E/AndroidRuntime(1926): java.lang.NullPointerException
03-05 01:33:25.799: E/AndroidRuntime(1926): at com.javapapers.android.androidjavamail.SendMailTask.onProgressUpdate(SendMailTask.java:51)
03-05 01:33:25.799: E/AndroidRuntime(1926): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:648)
03-05 01:33:25.799: E/AndroidRuntime(1926): at android.os.Handler.dispatchMessage(Handler.java:102)
03-05 01:33:25.799: E/AndroidRuntime(1926): at android.os.Looper.loop(Looper.java:136)
03-05 01:33:25.799: E/AndroidRuntime(1926): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-05 01:33:25.799: E/AndroidRuntime(1926): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 01:33:25.799: E/AndroidRuntime(1926): at java.lang.reflect.Method.invoke(Method.java:515)
03-05 01:33:25.799: E/AndroidRuntime(1926): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-05 01:33:25.799: E/AndroidRuntime(1926): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-05 01:33:25.799: E/AndroidRuntime(1926): at dalvik.system.NativeStart.main(Native Method)
Code is below. In Gmail.java class Inside sendEmail method at this line javax.mail.AuthenticationFailedException is coming
transport.connect(emailHost, fromEmail, fromPassword);
public void sendEmail() throws AddressException, MessagingException {
Transport transport = mailSession.getTransport("smtp");
System.out.println("emailHost="+emailHost);
System.out.println("fromEmail="+fromEmail);
System.out.println("fromPassword="+fromPassword);
transport.connect(emailHost, fromEmail, fromPassword);
Log.i("GMail","allrecipients: "+emailMessage.getAllRecipients());
transport.sendMessage(emailMessage, emailMessage.getAllRecipients());
transport.close();
Log.i("GMail", "Email sent successfully.");
}
In SendMailTask.java class I am getting NullPointerException at this line
statusDialog.setMessage(values[0].toString());
#Override
public void onProgressUpdate(Object... values) {
statusDialog.setMessage(values[0].toString());
}
can anyone help me.
You need to provide the exact email id and password of the gmail account from which you need to send the mail
I don't know about the Java part but I do know about smtp and that what you haven't included is either of the smtp ports that allows Gmail to parse it's code into an email editor follow this link from Google about smtp and rewrite you code accordingly. Link = https://support.google.com/a/answer/176600?hl=en
Related
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
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.
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.
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...
I'm begginer in android Programming
My Question is...
I wanted to play backgroud Music.
So I read a code like this
public class Welcome extends Activity {
/** Called when the activity is first created. */
MediaPlayer player;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
player=MediaPlayer.create(Welcome.this, R.raw.song);
player.start();
But this code doesn't work in emulator. Error occured...
My Logcat is here..
03-05 15:36:36.588: ERROR/AndroidRuntime(954): FATAL EXCEPTION: main
03-05 15:36:36.588: ERROR/AndroidRuntime(954): java.lang.RuntimeException: Unable to start activity ComponentInfo{younkyung.app.lord_of_spelling/younkyung.app.lord_of_spelling.Welcome}: java.lang.NullPointerException
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.os.Handler.dispatchMessage(Handler.java:99)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.os.Looper.loop(Looper.java:123)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at java.lang.reflect.Method.invoke(Method.java:521)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at dalvik.system.NativeStart.main(Native Method)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): Caused by: java.lang.NullPointerException
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at younkyung.app.lord_of_spelling.Welcome.onCreate(Welcome.java:25)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-05 15:36:36.588: ERROR/AndroidRuntime(954): ... 11 more
I cannot understand what's wrong...
Please Help..! ...
You need to use one of the supported file formats. WMA is not one of them.