Note that there are some explanatory texts on larger screens.

plurals
  1. POthrows Uncaught Exception
    text
    copied!<p>I tried to insert web service data in SQLite DB . But it shows error while creation of DB. with this i have attached my code and error.</p> <p>public class Disclaimer extends Activity {</p> <pre><code>GPSTracker gps; static String latlan; DatabaseHandler db; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.disclaimer); /*Getting GPS Location and Address Convertion , Lat and lang*/ gps = new GPSTracker(getApplicationContext()); db = new DatabaseHandler(getApplicationContext()); //db = new DatabaseHandler(); latlan=String.valueOf(gps.getLatitude())+","+String.valueOf(gps.getLongitude()); Global.setlatlan(latlan); Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); try { List&lt;Address&gt; address = geocoder.getFromLocation(gps.getLatitude(),gps.getLongitude(), 1); if(address != null) { Address returnedAddress = address.get(0); StringBuilder strReturnedAddress = new StringBuilder("Source Address \n\n"); for(int i=0; i&lt;returnedAddress.getMaxAddressLineIndex(); i++) { strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n"); } String curadr = strReturnedAddress.toString(); Global.setCurrAddress(curadr); } else{ Global.setCurrAddress("No Address Defined"); } } catch (IOException e) { e.printStackTrace(); } /*Getting Device ID */ TelephonyManager mTelephonyMgr; mTelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String devno = mTelephonyMgr.getDeviceId(); //Global.setDeviceID(devno); Global.setDeviceID("359462040979303"); /*Calling Setting Service Details */ SettingsService set = new SettingsService(); /*Button Action Activities*/ Button agree = (Button)findViewById(R.id.btnagree); agree.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub gps = new GPSTracker(Disclaimer.this); // check if GPS enabled if(gps.canGetLocation()){ /* Include App Web Service for Settings and Current Location and DB Storage*/ String Settingres = Global.getResult(); //String Settingres =null; Toast.makeText(getApplicationContext(), Settingres, Toast.LENGTH_LONG).show(); //db = new DatabaseHandler(getApplicationContext()); List&lt;Details&gt; contacts = db.getAllContacts(); //check for setting result if(Settingres.equals(null)==true) { /*Toast.makeText(getApplicationContext(), "check DB", Toast.LENGTH_LONG).show(); boolean val =contacts.isEmpty(); Toast.makeText(getApplicationContext(),String.valueOf(val), Toast.LENGTH_LONG).show();*/ if((contacts.isEmpty())==true) { Toast.makeText(getApplicationContext(),"Your Application Settings Not Loaded", Toast.LENGTH_LONG).show(); } else { for (Details cn : contacts) { String log = "APP ID: "+cn.getAPPID()+" ,Unique ID: " + cn.getUniqueID() + " ,Driver Name: " + cn.getDriverName()+ " ,Vehicle Name: " + cn.getVehicleName()+ " ,Mobile number: " + cn.getPhoneNumber(); Log.d("Name: ", log); // Toast.makeText(getApplicationContext(), log, Toast.LENGTH_LONG).show(); } } } else if(Settingres.equals("Device Not Updated")==true) { if((contacts.isEmpty())==true) { Toast.makeText(getApplicationContext(),"Your Application Settings Not Loaded.Contact Customer Care", Toast.LENGTH_LONG).show(); } else { for (Details cn : contacts) { String log = "APP ID: "+cn.getAPPID()+" ,Unique ID: " + cn.getUniqueID() + " ,Driver Name: " + cn.getDriverName()+ " ,Vehicle Name: " + cn.getVehicleName()+ " ,Mobile number: " + cn.getPhoneNumber(); Log.d("Name: ", log); // Toast.makeText(getApplicationContext(), log, Toast.LENGTH_LONG).show(); } } } else { //Store in Setting DB if((contacts.isEmpty())==true) { db.addDetails(new Details(Settingres)); } else { db.dropAllTable(getApplicationContext()); db.addDetails(new Details(Settingres)); } CurrentTime tim = new CurrentTime(); LocationService curadrloc = new LocationService("App Open"); Intent mainscr = new Intent(Disclaimer.this, MainScreen.class); startActivity(mainscr); } /*List&lt;Details&gt; contacts1 = db.getAllContacts(); for (Details cn : contacts1) { Global.setAppID(cn.getAPPID()); String log = "APP ID: "+cn.getAPPID()+" ,Unique ID " + cn.getUniqueID() + " ,Driver Name: " + cn.getDriverName()+ " ,Vehicle Name: " + cn.getVehicleName()+ " ,Mobile number: " + cn.getPhoneNumber(); Log.d("Name: ", log); Toast.makeText(getApplicationContext(), log, Toast.LENGTH_LONG).show(); } */ /*// Call current location Service CurrentTime tim = new CurrentTime(); LocationService curadrloc = new LocationService("App Open"); Intent mainscr = new Intent(Disclaimer.this, MainScreen.class); startActivity(mainscr);*/ //db.close(); } else{ gps.showSettingsAlert(); } } }); Button disagree =(Button)findViewById(R.id.btndisagree); disagree.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); } public void currentdetail() { Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); try { List&lt;Address&gt; address = geocoder.getFromLocation(gps.getLatitude(),gps.getLongitude(), 1); if(address != null) { Address returnedAddress = address.get(0); StringBuilder strReturnedAddress = new StringBuilder("Source Address \n\n"); for(int i=0; i&lt;returnedAddress.getMaxAddressLineIndex(); i++) { strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n"); } String curadr = strReturnedAddress.toString(); Global.setCurrAddress(curadr); } else{ Global.setCurrAddress("No Address Defined"); } } catch (IOException e) { e.printStackTrace(); } } </code></pre> <p>}</p> <p>My Errors are</p> <p>some times like</p> <pre><code>10-25 11:03:26.580: W/dalvikvm(1101): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 10-25 11:03:26.580: E/AndroidRuntime(1101): Uncaught handler: thread main exiting due to uncaught exception 10-25 11:03:26.585: E/AndroidRuntime(1101): java.lang.ArrayIndexOutOfBoundsException 10-25 11:03:26.585: E/AndroidRuntime(1101): at com.example.routemytrip.Details.&lt;init&gt;(Details.java:22) 10-25 11:03:26.585: E/AndroidRuntime(1101): at com.example.routemytrip.Disclaimer$1.onClick(Disclaimer.java:153) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.View.performClick(View.java:2364) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.View.onTouchEvent(View.java:4179) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.widget.TextView.onTouchEvent(TextView.java:6540) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.View.dispatchTouchEvent(View.java:3709) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:26.585: E/AndroidRuntime(1101): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) 10-25 11:03:26.585: E/AndroidRuntime(1101): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 10-25 11:03:26.585: E/AndroidRuntime(1101): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.os.Handler.dispatchMessage(Handler.java:99) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.os.Looper.loop(Looper.java:123) 10-25 11:03:26.585: E/AndroidRuntime(1101): at android.app.ActivityThread.main(ActivityThread.java:4363) 10-25 11:03:26.585: E/AndroidRuntime(1101): at java.lang.reflect.Method.invokeNative(Native Method) 10-25 11:03:26.585: E/AndroidRuntime(1101): at java.lang.reflect.Method.invoke(Method.java:521) 10-25 11:03:26.585: E/AndroidRuntime(1101): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 10-25 11:03:26.585: E/AndroidRuntime(1101): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 10-25 11:03:26.585: E/AndroidRuntime(1101): at dalvik.system.NativeStart.main(Native Method) 10-25 11:03:26.607: I/dalvikvm(1101): threadid=7: reacting to signal 3 10-25 11:03:26.607: E/dalvikvm(1101): Unable to open stack trace file '/data/anr/traces.txt': Permission denied </code></pre> <p>and sometimes like </p> <pre><code>10-25 11:03:08.965: E/Database(956): Leak found 10-25 11:03:08.965: E/Database(956): java.lang.IllegalStateException: /data/data/com.example.routemytrip/databases/RouteFetchMgr SQLiteDatabase created and never closed 10-25 11:03:08.965: E/Database(956): at android.database.sqlite.SQLiteDatabase.&lt;init&gt;(SQLiteDatabase.java:1694) 10-25 11:03:08.965: E/Database(956): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:738) 10-25 11:03:08.965: E/Database(956): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:760) 10-25 11:03:08.965: E/Database(956): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:753) 10-25 11:03:08.965: E/Database(956): at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:473) 10-25 11:03:08.965: E/Database(956): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193) 10-25 11:03:08.965: E/Database(956): at com.example.routemytrip.RouteDBHandler.dropAllTable(RouteDBHandler.java:86) 10-25 11:03:08.965: E/Database(956): at com.example.routemytrip.MainScreen$7.onClick(MainScreen.java:415) 10-25 11:03:08.965: E/Database(956): at android.view.View.performClick(View.java:2364) 10-25 11:03:08.965: E/Database(956): at android.view.View.onTouchEvent(View.java:4179) 10-25 11:03:08.965: E/Database(956): at android.widget.TextView.onTouchEvent(TextView.java:6540) 10-25 11:03:08.965: E/Database(956): at android.view.View.dispatchTouchEvent(View.java:3709) 10-25 11:03:08.965: E/Database(956): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:08.965: E/Database(956): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:08.965: E/Database(956): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:08.965: E/Database(956): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 10-25 11:03:08.965: E/Database(956): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) 10-25 11:03:08.965: E/Database(956): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 10-25 11:03:08.965: E/Database(956): at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 10-25 11:03:08.965: E/Database(956): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 10-25 11:03:08.965: E/Database(956): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 10-25 11:03:08.965: E/Database(956): at android.os.Handler.dispatchMessage(Handler.java:99) 10-25 11:03:08.965: E/Database(956): at android.os.Looper.loop(Looper.java:123) 10-25 11:03:08.965: E/Database(956): at android.app.ActivityThread.main(ActivityThread.java:4363) 10-25 11:03:08.965: E/Database(956): at java.lang.reflect.Method.invokeNative(Native Method) 10-25 11:03:08.965: E/Database(956): at java.lang.reflect.Method.invoke(Method.java:521) 10-25 11:03:08.965: E/Database(956): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 10-25 11:03:08.965: E/Database(956): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 10-25 11:03:08.965: E/Database(956): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>can anyone help me for solution</p>
 

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