我运行以下代码并获得Java.lang.StringOutOfBound Exception
SQLiteDatabase sb;
String g="o";
String []gt={"0"};
try {
sb=SQLiteDatabase.openDatabase("data/data/com.example.datatestx/ma", null, SQLiteDatabase.CREATE_IF_NECESSARY);
sb.execSQL("create table if not exists blac (" + " phone text , " + " ftime text, " + " ttime text ); " );
sb.execSQL( "insert into blac(phone, ftime,ttime) values ('01741297133', '333333','33333' );" );
sb.execSQL( "insert into blac(phone, ftime,ttime) values ('01761233433', '777' ,'77777');" );
sb.execSQL( "insert into blac(phone, ftime,ttime) values ('01712333333', '999','33433' );" );
//Cursor c1 = sb.rawQuery( "select * from blac where phone=?", gt);
String gb="33";
String gh = "SELECT * FROM blac where( phone like '%"+gb+" ')"+"ORDER BY phone";
Cursor c1 = sb.rawQuery( gh,null);
if(c1.getCount()>0){
c1.moveToFirst();
do {
g=g+c1.getString(c1.getColumnIndex("phone"));
}while(c1.moveToNext());
} c1.close();
sb.close();
Toast.makeText(getApplicationContext(), "Success!"+g, Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
但是在运行代码之后.. o g的值没有改变,请这里的任何人帮助我。