Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String user_name;
- public static String user_level;
- public void user_id(){
- SQLiteDatabase db = this.getWritableDatabase();
- Cursor crs = db.rawQuery("SELECT * FROM android_api", null);
- List<String> array = new ArrayList<String>();
- while(crs.moveToNext()){
- user_name=crs.getString(crs.getColumnIndex("name"));
- user_level = crs.getString(crs.getColumnIndex("level"));
- // adding data to list
- // use Hashmap as gobal variables so you can print in activity
- HashMap<Integer,String> hm=new HashMap<Integer,String>();
- hm.put(user_name,user_level);
- }
- }
- -------------------
- print values it as
- for(Map.Entry m:hm.entrySet()){
- System.out.println(m.getKey()+" "+m.getValue());
- }
Add Comment
Please, Sign In to add comment