|
|
|
Android - สามารถ Run บน emu ได้ แต่ไม่สามารถ run บน device ได้ |
|
|
|
|
|
|
|
คือว่า พอ Run ใน emu ไม่มีปัญหาใดๆ เลย แต่พอมา Run บน device มันก็ Error แล้วน่ะครับ
Code (Java)
String[] idowner = new String[10];
String[] name = new String[10];
String[] idpolice = new String[10];
String[] address = new String[10];
Double[] lat = new Double [10];
Double[] lng = new Double [10];
if(locationCursor.moveToFirst()){
l=0;
do {
idpolice[l] = locationCursor.getString(locationCursor
.getColumnIndex("idpolice"));
idowner[l] = locationCursor.getString(locationCursor
.getColumnIndex("idowner"));
name[l] = locationCursor.getString(locationCursor
.getColumnIndex("name"));
address[l] = locationCursor.getString(locationCursor
.getColumnIndex("address"));
latitude = (Double) locationCursor.getDouble(locationCursor
.getColumnIndex("latitude"));
longitude = (Double) locationCursor.getDouble(locationCursor
.getColumnIndex("longtitude"));
lat[l] = latitude;
lng[l] = longitude;
l++;
}while(locationCursor.moveToNext());
locationCursor.close();
}
for(int j=0;j<l;j++){
LatLng point = new LatLng(lat[j], lng[j]);
for(int k=0;k<l;k++){
LatLng count1 = new LatLng(lat[k], lng[k]);
if(lat[j]!=lat[k]){
GenDirection(point, count1);
if(DistanceValue != 0){
daba.insertgendb(idowner[j],idowner[k],DistanceValue, lat[j], lng[j], lat[k], lng[k]);
Log.d(idowner[j]+"",DistanceValue+" ; "+distance);
}
}
นี้คือส่วนที่ error
Code
07-08 19:07:23.612: E/AndroidRuntime(9628): FATAL EXCEPTION: main
07-08 19:07:23.612: E/AndroidRuntime(9628): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.police.checkpolice/com.police.checkpolice.Gendirection}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2332)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.ActivityThread.access$600(ActivityThread.java:151)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1330)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.os.Looper.loop(Looper.java:155)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.ActivityThread.main(ActivityThread.java:5536)
07-08 19:07:23.612: E/AndroidRuntime(9628): at java.lang.reflect.Method.invokeNative(Native Method)
07-08 19:07:23.612: E/AndroidRuntime(9628): at java.lang.reflect.Method.invoke(Method.java:511)
07-08 19:07:23.612: E/AndroidRuntime(9628): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1074)
07-08 19:07:23.612: E/AndroidRuntime(9628): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:841)
07-08 19:07:23.612: E/AndroidRuntime(9628): at dalvik.system.NativeStart.main(Native Method)
07-08 19:07:23.612: E/AndroidRuntime(9628): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
07-08 19:07:23.612: E/AndroidRuntime(9628): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
07-08 19:07:23.612: E/AndroidRuntime(9628): at java.util.ArrayList.get(ArrayList.java:304)
07-08 19:07:23.612: E/AndroidRuntime(9628): at com.police.checkpolice.GMapV2Direction.getDistanceValue(GMapV2Direction.java:82)
07-08 19:07:23.612: E/AndroidRuntime(9628): at com.police.checkpolice.Gendirection.GenDirection(Gendirection.java:278)
07-08 19:07:23.612: E/AndroidRuntime(9628): at com.police.checkpolice.Gendirection.onCreate(Gendirection.java:104)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.Activity.performCreate(Activity.java:5066)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1102)
07-08 19:07:23.612: E/AndroidRuntime(9628): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)
Tag : Mobile, Android
|
|
|
|
|
|
Date :
2013-07-08 19:10:46 |
By :
asdoo1000 |
View :
1082 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|