私はこれらの問題を抱えていますが、解決策を得ることができません
起動タイムアウトの期限が切れ、ウェイクロックを放棄しました。HistoryRecord{44e26a30com.india.screen/.CategoryList}のアクティビティアイドルタイムアウト
この問題は、これらの行を追加した後に発生します(String numOfRows = "select count(*)from Holyplace_Tbl where State_id ='" + stateId + "'";)コンソールはその後に何も出力しません
アクティビティ
public class CategoryList extends Activity{ private TableRow holyPlaces,historicalPalces,beach,museum,hills,lakes; private int stateId; private AssetDatabaseOpenHelper assetDatabaseHelper; private Cursor holyplacesCursor,rowsCursor; protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.category_screen); Bundle extras = getIntent().getExtras(); if (extras != null) { stateId=extras.getInt("stateid"); System.out.println("stateid"+stateId); } holyPlaces=(TableRow) findViewById(R.id.holyPlaces); historicalPalces=(TableRow) findViewById(R.id.historicalPlaces); museum=(TableRow) findViewById(R.id.museum); beach=(TableRow) findViewById(R.id.beach); hills=(TableRow) findViewById(R.id.hills); lakes=(TableRow) findViewById(R.id.lakes); assetDatabaseHelper=new AssetDatabaseOpenHelper(CategoryList.this); assetDatabaseHelper.openDatabase(); assetDatabaseHelper.openReadableMode(); System.out.println("success.....!"); String numOfRows="select count(*) from Holyplace_Tbl where State_id='"+stateId+"'"; System.out.println("rav "+numOfRows); rowsCursor=assetDatabaseHelper.executeQuery(numOfRows); System.out.println("hjkdfhfh .............................."+rowsCursor); System.out.println("hj hi .............................."+rowsCursor); if(rowsCursor.moveToFirst()) { System.out.println("hi.........."+rowsCursor.getColumnCount()); do{ int count=rowsCursor.getInt(0); System.out.println("cu "+count); System.out.println("cursor.. "+rowsCursor.getCount()); System.out.println("ccccc "+rowsCursor.getInt(0)); System.out.println("jdjhfhf "+rowsCursor.getColumnCount()); }while(rowsCursor.moveToNext()); } else{ System.out.println("cursor not move"); } rowsCursor.close(); assetDatabaseHelper.close(); System.out.println("no next value"); }
}
AssetDatabaseOpenHelper.class
public class AssetDatabaseOpenHelper { private Context context; private SQLiteDatabase sqliteDatabaseObj; private String database_name; private CreateQueries createQueriesObj; private MySQLiteHelper mySQLitehelperObj; private int database_version; private String databaseName="TravelguideDb"; private int databaseVersion=3; public AssetDatabaseOpenHelper(Context context,String databaseName,int database_version) { this.context = context; this.database_name=databaseName; this.database_version=database_version; } public AssetDatabaseOpenHelper(Context context) { this.context = context; this.database_name = databaseName; this.database_version = databaseVersion; } public void openDatabase() { mySQLitehelperObj = new MySQLiteHelper(context, database_name, database_version); File dbFile = context.getDatabasePath(database_name); System.out.println("Assests"+dbFile.exists()); if (!dbFile.exists()) { try { copyDatabase(dbFile); } catch (IOException e) { throw new RuntimeException("Error creating source database", e); } } } public void openReadableMode() { sqliteDatabaseObj = mySQLitehelperObj.getReadableDatabase(); } public void openWriteableMode() { sqliteDatabaseObj = mySQLitehelperObj.getWritableDatabase(); } public void close() { mySQLitehelperObj.close(); } private void copyDatabase(File dbFile) throws IOException { OutputStream os = new FileOutputStream(dbFile); InputStream is = null; byte[] buffer = new byte[1024]; for(int i=1;i<5;i++) { is = context.getAssets().open("TravelguideDb.sqlite.00"+1); int length; while ((length=is.read(buffer))!=-1) { os.write(buffer,0,length); } is.close(); } os.flush(); os.close(); is.close(); } public Cursor executeQuery(String query) { Cursor outputCursor= sqliteDatabaseObj.rawQuery(query, null); return outputCursor; } public void createTable(String tableName, String[] columns, String[] value) { createQueriesObj = new CreateQueries(); String createTableQuery = createQueriesObj.CreateTableQuery(tableName, columns, value); sqliteDatabaseObj.execSQL(createTableQuery); System.out.println("Query" + createTableQuery); } public void deleteTable(String tableName) { sqliteDatabaseObj.execSQL("Drop table " + tableName); } public void deleteAllDataFromTable(String tableName) { // truncate table sqliteDatabaseObj.delete(tableName, null, null); } public void deletePerticularRows(String tableName, String whereClause, String[] whereArgs) { sqliteDatabaseObj.delete(tableName, whereClause, whereArgs); } public Cursor fetchAllRows(String tableName) { return sqliteDatabaseObj.query(tableName, null, null, null, null, null, null); } public Cursor selectOnWhereCondition(String tableName, String[] columnsToSelect, String whereColumnName, String[] whereEqualsTo, String groupBy, String having, String orderBy) { return sqliteDatabaseObj.query(tableName, columnsToSelect, whereColumnName, whereEqualsTo, groupBy, having, orderBy); } public void updateRows(String tableName, String[] columnNames, String[] values, String whereClause, String[] whereArgs) throws SQLException { if (columnNames.length != values.length) { throw new SQLException(); } ContentValues contentValue = new ContentValues(); int length = values.length; for (int i = 0; i < length; i++) { contentValue.put(columnNames[i], values[i]); } sqliteDatabaseObj.update(tableName, contentValue, whereClause, whereArgs); } public long addRecords(String TableName, String[] columnNames, String[] values) throws SQLException { long result = 0; if (columnNames.length != values.length) { throw new SQLException(); } else { ContentValues contentValues = new ContentValues(); int length = columnNames.length; for (int i = 0; i < length; i++) { contentValues.put(columnNames[i], values[i]); } result = sqliteDatabaseObj.insert(TableName, null, contentValues); } return result; }
}