将editText中的数据放入表中

时间:2014-03-22 22:14:30

标签: android eclipse

我是android的初学者,我在eclipse中制作表格,并且我想要检索用户输入的信息,以便在按下按钮REGISTER时将其放入名为user的表中

我应该写什么代码来做到这一点?

1 个答案:

答案 0 :(得分:0)

    params.add(new BasicNameValuePair("mobile_number", number));
    params.add(new BasicNameValuePair("password", pwd));
    params.add(new BasicNameValuePair("hint", h));
    params.add(new BasicNameValuePair("email_id", id));

    JSONObject json = jsonParser.makeHttpRequest(url,"POST", params);

    Log.d("Create Response", json.toString());

    try {
        int success = json.getInt(TAG_SUCCESS);
        if (success == 1) 
         {
          flag=0;   
          Intent i = new Intent(getApplicationContext(),Welcome.class);
          i.putExtra("mobile_number",number);
          i.putExtra("password",pwd);
          startActivity(i);
          finish();
         }
         else
         {
            // failed to Sign in
            flag=1;
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;
相关问题