[code="java"]
public List> findMovieByRegion(String region){
List<Map<String, Object>> movieList = new ArrayList<Map<String, Object>>();
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor cursor = db.rawQuery("select num from Online_movie where region=?", new String[]{region});
while(cursor.moveToNext()){
int aa = cursor.getInt(cursor.getColumnIndex("num"));
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("aaa", aa);
System.out.println(map);
movieList.add(map);
}
return movieList;
}
//______________________________________________
下面是 遍历上面 数据库中的 集合
MovieService ms = new MovieService(this.getBaseContext());
List<Map<String,Object>> typenum = ms.findMovieByRegion("美国");
for (Iterator<Map<String, Object>> typeiterator = typenum.iterator(); typeiterator.hasNext();) {
Object num = typeiterator.next();
//这里打印的 num 是{aaa=10},{aaa=9},{aaa=3}可是 我只想得到 10,9,3这几个数字 因为 有花括号的话 组成的路径就是错误的
Log.v("num===ggggggggggggggg>", ""+num);
listmap = FileList.findFile(Environment.getExternalStorageDirectory()+"/Pictures/"+num+".jpg");
}
[/code]