1
내 장치에 3000 자 이상이 있습니다. 데이터베이스의 모든 메시지를 읽으려고합니다. 나는이 쿼리를 사용하고 있습니다 :데이터베이스에서 SMS 레코드 읽기 android
Cursor cur1 = c.getContentResolver().query(Uri.parse("content://sms/"), null, null, null, null);
cur1.getCount()
이 반환 모든 3000 SMS를,하지만 난 루프를 통해 해석 할 때에 만
Cursor cur1 = c.getContentResolver().query(Uri.parse("content://sms/"), null, null, null, null);
int size = cur1.getCount();
if(size > 0)
{
sms = new SMS[size];
//int i = 0;
for(int i = 0 ; i < size ; i++)
{
cur1.moveToNext();
ContactInfo p = new ContactInfo();
String content = cur1.getString(cur1.getColumnIndex("body"));
String number = cur1.getString(cur1.getColumnIndex("address"));
long date = cur1.getLong(cur1.getColumnIndex("date"));
String person = cur1.getString(cur1.getColumnIndex("person"));
String protocol = cur1.getString(cur1.getColumnIndex("protocol"));
String name = p.getName(number, c);
String type = null;
Calendar cal=Calendar.getInstance();
cal.clear();
cal.setTimeInMillis(date);
String date_time=String.format("%1$te %1$tB %1$tY,%1$tI:%1$tM:%1$tS %1$Tp",cal);
Log.i("INFO", content+" "+i);
sms[i] = new SMS(type , name , number , date_time , content);
}
}
500 후 400 ~ 500 반복을 통해 실행
09-19 20:28:31.148: E/liblog(3153): failed to call dumpstate
09-19 20:28:31.179: I/ActivityManager(3153): Process com.arslan (pid 1766) has died.
예외가 발생합니까? – Fildor
그래서 for 루프에서 처음 400-500 회 반복 한 후에 어떻게됩니까? –
루프가 너무 일찍 종료되는 이유가 없습니다. logcat에 아무것도 나타나지 않습니까? – Turnsole