I don't know why this error is thrown. Only when a loop is used does the app crash. I am importing an ArrayList < ArrayList < Point > > into the ndk. I can't open video files in ndk with opencv for videoprocessing, hence I am getting the positions with javacv on the java side (I am new to android in general and I could not find a more elegant method)
The outer array has a length of 10 (max 50) and inner has a varying length (200 - 500)
I initially thought maybe it is due memory limits in android. I believe now that it cannot be because I ran an empty loop iterating 10 times. It gives me the same error. I don't understand what this error means.
I am new to android. Can someone help me out? How should go about this? I am grateful for any and all suggestions. Thanks in advance!
CODE:
// Class totd to get obj arraylist
jclass totd = env -> FindClass ("java/util/ArrayList");
//Methods in totd
jmethodID totd_get = env-> GetMethodID (totd, "get", "(I)Ljava/lang/Object;");
jmethodID totd_size = env-> GetMethodID (totd, "size", "()I");
//Get length of ArrayList
jint totd_len = env-> CallIntMethod (totdat,totd_size);
//start loop for each frame process data:
jint i;
vector<vector<Point> > totalpnts;
for (i=0;i<=totd_len;i++){
//Get postion data for current frame
jobject fd = env-> CallObjectMethod (totdat,totd_get,i);
jclass curd = env-> FindClass ("java/util/ArrayList");
//Get methods of inner array
jmethodID curd_get = env-> GetMethodID (curd, "get", "(I)Ljava/lang/Object;");
jmethodID curd_size = env-> GetMethodID (curd, "size", "()I");
//Get no. of objects found
jint objcnt = env-> CallIntMethod (fd,curd_size);
//Extract data from point
jlong j = 0;
vector<Point> framepnts;
//for(j = 0; j <= objcnt ; j++){
//Id objlist
jobject ptxy = env-> CallObjectMethod (fd,curd_get,j);
jclass pnt = env-> GetObjectClass(ptxy);
jmethodID constr = env->GetMethodID(pnt, "<init>", "(II)V");
jfieldID fix = env->GetFieldID(pnt, "x", "I");
jfieldID fiy = env->GetFieldID(pnt, "y", "I");
Point xy;
xy.x = env-> GetIntField(ptxy,fix);
xy.y = env-> GetIntField(ptxy,fiy);
framepnts.push_back(xy);
//}
totalpnts.push_back(framepnts);
}
ERROR:
05-08 13:30:38.593: E/dalvikvm(17064): VM aborting
05-08 13:30:38.595: A/libc(17064): Fatal signal 6 (SIGABRT) at 0x000042a8 (code=-6), thread 17064 (st.trackerproto)