mardi 15 septembre 2015

how to get value return from the mysql database in insert value operation in android

i am new in android, i am inserting some values in MySQL database with j son. when i am inserting value in DB then user id fill with auto increment operation, i want to get this id after inserting operation and want to save it in local DB with sq lite. what i do for it.

 params.add(new BasicNameValuePair("police_verified", uname));
        params.add(new BasicNameValuePair("timezone", p_mobile));
        params.add(new BasicNameValuePair("fb_id", p_mobile));
        params.add(new BasicNameValuePair("gid", p_mobile));
        params.add(new BasicNameValuePair("service_provider_bit", ""));




        // getting JSON Object
        // Note that create product url accepts POST method
        JSONObject json = jsonParser.makeHttpRequest(url_create_users,
                "POST", params);

        // check log cat fro response
        Log.d("Create Response", json.toString());

        // check for success tag
        try {
            int success = json.getInt(TAG_SUCCESS);

            if (success == 1) {

                //Save in to Local DB
                mHelper = new MyDbHelper(InsertInfoActivity.this);
                mHelper.open();
                boolean isSaved = AddData();


                if(isSaved=true) {
                    InsertInfoActivity.this.runOnUiThread(new Runnable() {
                        public void run() {
                            Toast.makeText(InsertInfoActivity.this, "Data inserted", Toast.LENGTH_LONG).show();
                        }
                    });

Aucun commentaire:

Enregistrer un commentaire