@Override /** * Describe <code>getCount</code> method here. * * @return an <code>int</code> value */ public int getCount() { int count = 0; for (Cursor cur : mSmsCursorArray) { if (cur != null && !cur.isClosed() && cur.getCount() > 0) { count += cur.getCount(); } } MyLogger.logD(CLASS_TAG, "getCount():" + count); return count; }
@Override /** * Describe <code>isAfterLast</code> method here. * * @return a <code>boolean</code> value */ public boolean isAfterLast() { boolean result = true; for (Cursor cur : mSmsCursorArray) { if (cur != null && !cur.isAfterLast()) { result = false; break; } } MyLogger.logD(CLASS_TAG, "isAfterLast():" + result); return result; }
/** Describe <code>onEnd</code> method here. */ public final void onEnd() { super.onEnd(); try { MyLogger.logD(CLASS_TAG, "SmsBackupComposer onEnd"); if (mWriter != null) { MyLogger.logE(CLASS_TAG, "mWriter.close()"); mWriter.close(); } } catch (Exception e) { MyLogger.logE(CLASS_TAG, "mWriter.close() failed"); } for (Cursor cur : mSmsCursorArray) { if (cur != null) { cur.close(); cur = null; } } }
@Override /** * Describe <code>init</code> method here. * * @return a <code>boolean</code> value */ public boolean init() { boolean result = false; for (int i = 0; i < mSmsUriArray.length; ++i) { mSmsCursorArray[i] = mContext.getContentResolver().query(mSmsUriArray[i], null, null, null, "date ASC"); if (mSmsCursorArray[i] != null) { mSmsCursorArray[i].moveToFirst(); result = true; } } MyLogger.logD(CLASS_TAG, "init():" + result + ",count:" + getCount()); return result; }