Android 数据库插入故障

Android 数据库插入故障,android,database,sqlite,android-sqlite,Android,Database,Sqlite,Android Sqlite,我的应用程序我从textview获取用户名和密码,并将其保存在数据库中,在我参与检索这些值时,它显示出一定的问题 插入代码 int id=1; String id1 = Integer.toString(id); passwordTxtValue = passwordTxt.getText().toString(); passwordTxtValue2 = passwordTxt2.getText().toString();

我的应用程序我从textview获取用户名和密码,并将其保存在数据库中,在我参与检索这些值时,它显示出一定的问题

插入代码

int id=1;
String id1 = Integer.toString(id);
              passwordTxtValue = passwordTxt.getText().toString();
              passwordTxtValue2 = passwordTxt2.getText().toString();


              if(passwordTxtValue.equals(passwordTxtValue2))
              {

                    try 
                    {
                        db_obj.password_varification(id1, passwordTxtValue);
                        Log.e("Insert Values"," " );
                        PASSWORD_DATA = db_obj.password_records();
                    System.out.println("The value is"+PASSWORD_DATA.size());

                    } 
                    catch (Exception e) 
                    {
                    }
              } 

              else
              {
                  Toast.makeText(getApplicationContext(), "Enter values correctly!!!", Toast.LENGTH_SHORT).show();
                    passwordTxt.setText("");
                    passwordTxt2.setText("");
              }
OpenHelper类是

static final String password_table = "password_db";
static final String table_id = "table_id";
static final String password = "password";
 @Override
public void onCreate(SQLiteDatabase db) 
{

    db.execSQL("CREATE TABLE "+password_table+"("+table_id+" INTEGER PRIMARY KEY, "+password+" TEXT)");


}
public void password_varification(String id,String paswrd ) 
    {
         Log.d("DB", "Inset_User OK" );
        SQLiteDatabase db=this.getWritableDatabase();
        ContentValues cv=new ContentValues();

        cv.put(table_id, id);
         cv.put(password, paswrd);

         db.insert(password_table, null, cv);


         db.close();
         Log.v("DB", "Inset_User OK" + ""+ id + paswrd); 
    }
 // password Data retrive here
public ArrayList<HashMap<String, String>> password_records() 
{
     SQLiteDatabase db=getReadableDatabase();
     ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();

     Cursor cursor=db.rawQuery("SELECT "+table_id+" as _id,  "+password+" from "+password_table,new String [] {});
    //Cursor cursor=db.rawQuery("SELECT "+row+" as _id, "+twitter+" from "+winery_info_2,new String [] {});


         if(cursor!=null)             
         {
             if(cursor.moveToFirst())  // movies first column 
             {
                 do
                 {
                     HashMap<String, String> map = new HashMap<String, String>();

                     String  fnam        = cursor.getString(cursor.getColumnIndex("table_id"));
                     String  lnam        = cursor.getString(cursor.getColumnIndex("password"));

                     map.put (table_id      ,fnam);
                     map.put (password      ,lnam);

                     list.add(map);
                 }
                 while(cursor.moveToNext()); // move to next row

             }
         }

         if (cursor != null && !cursor.isClosed()) 

         {
            cursor.close();
         }

         return list;
   }
static final String password\u table=“password\u db”;
静态最终字符串table_id=“table_id”;
静态最终字符串password=“password”;
@凌驾
public void onCreate(SQLiteDatabase db)
{
db.execSQL(“创建表”+密码表+”(“+表id+”整数主键,“+密码+”文本)”);
}
公共无效密码变量(字符串id、字符串paswrd)
{
Log.d(“DB”,“插入用户OK”);
SQLiteDatabase db=this.getWritableDatabase();
ContentValues cv=新的ContentValues();
cv.put(表号,id);
简历输入(密码,paswrd);
db.insert(密码表,空,cv);
db.close();
Log.v(“DB”,“Inset_User OK”+“”+id+paswrd);
}
//在此检索密码数据
公共ArrayList密码_记录()
{
SQLiteDatabase db=getReadableDatabase();
ArrayList=新建ArrayList();
Cursor Cursor=db.rawQuery(“从“+password\u table,新字符串[]{}”中选择“+table\u id+”作为_id”,“+password+”);
//Cursor Cursor=db.rawQuery(“选择“+row+”作为_id,+twitter+”来自“+winery_info_2,新字符串[]{}”);
如果(光标!=null)
{
if(cursor.moveToFirst())//第一列
{
做
{
HashMap=newHashMap();
String fnam=cursor.getString(cursor.getColumnIndex(“table_id”));
字符串lnam=cursor.getString(cursor.getColumnIndex(“密码”));
map.put(表号,fnam);
map.put(密码,lnam);
列表。添加(地图);
}
while(cursor.moveToNext());//移动到下一行
}
}
if(cursor!=null&!cursor.isClosed())
{
cursor.close();
}
退货清单;
}

它显示了一些非法状态异常

您可以发布日志猫吗?请在异常时发布日志猫输出。