use of android.database.CursorIndexOutOfBoundsException in project newsrob by marianokamp.
the class ShowArticleActivity method onPause.
@Override
protected void onPause() {
final String tmpTitle = selectedEntry != null ? selectedEntry.getTitle() : "Selected Entry is null";
PL.log("ADV: onPause() Article " + tmpTitle + " was already read=" + articleWasAlreadyRead + " leaving this activity=" + leavingThisActivity, this);
if (!leavingThisActivity && !articleWasAlreadyRead) {
Entry selectedEntry = getSelectedEntry();
if (selectedEntry != null && selectedEntry.getReadState() == ReadState.READ) {
PL.log("ADV: onPause() Article " + selectedEntry.getTitle() + " submitting mark unread", this);
setArticleReadStateAsynchronously(selectedEntry, ReadState.UNREAD);
}
}
getEntryManager().removeListener(this);
webView.stopLoading();
webView.clearCache(true);
if (false)
googleAdsUtil.hideAds(this);
if (getSelectedEntry() != null) {
try {
savedContentCursorPosition = contentCursor.getPosition();
savedContentCursoCurrentId = contentCursor.getLong(0);
} catch (CursorIndexOutOfBoundsException cioobe) {
savedContentCursorPosition = -1;
savedContentCursoCurrentId = null;
}
}
if (false)
UIHelper.pauseWebViews(this);
webView.pauseTimers();
try {
Method m = webView.getClass().getMethod("onPause", null);
m.invoke(webView, new Object[] {});
} catch (Exception e) {
e.printStackTrace();
}
super.onPause();
}
use of android.database.CursorIndexOutOfBoundsException in project android_frameworks_base by DirtyUnicorns.
the class DatabaseCursorTest method testCursor1.
@MediumTest
public void testCursor1() throws Exception {
populateDefaultTable();
Cursor c = mDatabase.query("test", null, null, null, null, null, null);
int dataColumn = c.getColumnIndexOrThrow("data");
// The cursor should ignore text before the last period when looking for a column. (This
// is a temporary hack in all implementations of getColumnIndex.)
int dataColumn2 = c.getColumnIndexOrThrow("junk.data");
assertEquals(dataColumn, dataColumn2);
assertSame(3, c.getCount());
assertTrue(c.isBeforeFirst());
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
c.moveToNext();
assertEquals(1, c.getInt(0));
String s = c.getString(dataColumn);
assertEquals(sString1, s);
c.moveToNext();
s = c.getString(dataColumn);
assertEquals(sString2, s);
c.moveToNext();
s = c.getString(dataColumn);
assertEquals(sString3, s);
c.moveToPosition(-1);
c.moveToNext();
s = c.getString(dataColumn);
assertEquals(sString1, s);
c.moveToPosition(2);
s = c.getString(dataColumn);
assertEquals(sString3, s);
int i;
for (c.moveToFirst(), i = 0; !c.isAfterLast(); c.moveToNext(), i++) {
c.getInt(0);
}
assertEquals(3, i);
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
c.close();
}
use of android.database.CursorIndexOutOfBoundsException in project android_frameworks_base by crdroidandroid.
the class DatabaseCursorTest method testCursor2.
@MediumTest
public void testCursor2() throws Exception {
populateDefaultTable();
Cursor c = mDatabase.query("test", null, "_id > 1000", null, null, null, null);
assertEquals(0, c.getCount());
assertTrue(c.isBeforeFirst());
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
int i;
for (c.moveToFirst(), i = 0; !c.isAfterLast(); c.moveToNext(), i++) {
c.getInt(0);
}
assertEquals(0, i);
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
c.close();
}
use of android.database.CursorIndexOutOfBoundsException in project android_frameworks_base by AOSPA.
the class DatabaseCursorTest method testCursor2.
@MediumTest
public void testCursor2() throws Exception {
populateDefaultTable();
Cursor c = mDatabase.query("test", null, "_id > 1000", null, null, null, null);
assertEquals(0, c.getCount());
assertTrue(c.isBeforeFirst());
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
int i;
for (c.moveToFirst(), i = 0; !c.isAfterLast(); c.moveToNext(), i++) {
c.getInt(0);
}
assertEquals(0, i);
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
c.close();
}
use of android.database.CursorIndexOutOfBoundsException in project android_frameworks_base by AOSPA.
the class DatabaseCursorTest method testCursor1.
@MediumTest
public void testCursor1() throws Exception {
populateDefaultTable();
Cursor c = mDatabase.query("test", null, null, null, null, null, null);
int dataColumn = c.getColumnIndexOrThrow("data");
// The cursor should ignore text before the last period when looking for a column. (This
// is a temporary hack in all implementations of getColumnIndex.)
int dataColumn2 = c.getColumnIndexOrThrow("junk.data");
assertEquals(dataColumn, dataColumn2);
assertSame(3, c.getCount());
assertTrue(c.isBeforeFirst());
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
c.moveToNext();
assertEquals(1, c.getInt(0));
String s = c.getString(dataColumn);
assertEquals(sString1, s);
c.moveToNext();
s = c.getString(dataColumn);
assertEquals(sString2, s);
c.moveToNext();
s = c.getString(dataColumn);
assertEquals(sString3, s);
c.moveToPosition(-1);
c.moveToNext();
s = c.getString(dataColumn);
assertEquals(sString1, s);
c.moveToPosition(2);
s = c.getString(dataColumn);
assertEquals(sString3, s);
int i;
for (c.moveToFirst(), i = 0; !c.isAfterLast(); c.moveToNext(), i++) {
c.getInt(0);
}
assertEquals(3, i);
try {
c.getInt(0);
fail("CursorIndexOutOfBoundsException expected");
} catch (CursorIndexOutOfBoundsException ex) {
// expected
}
c.close();
}
Aggregations