我让用户注册,一个土星号,存在了本地数据㐭中,在要显示的控件上显示时,注册的土星是:“yyyyyy”,显示时,却成了SQLiteCuresor@Zero○
我就是用的根据用户名去查对应的土星号哈
下面是查询数据库的代码:
//土星号
tuzhu_saturn_num = getActivity().findViewById(R.id.tuzhu_saturn_num);
DBHelper helper = new DBHelper(getActivity(), "system.db");
SQLiteDatabase dbRead = helper.getReadableDatabase();Cursor dbNum = dbRead.rawQuery(
"select saturn_num from user where username=?", new String[]{userName});
String saturnNum = dbNum.toString();
tuzhu_saturn_num.setText(saturnNum);
dbNum.close();//及时关闭,否则内存泄露
dbRead.close();
下面是debug查询出来的图片