{"action":"opened","issue":{"url":"https://api.github.com/repos/tvavinash10/canteen_project_mobile_apps/issues/1","labels_url":"https://api.github.com/repos/tvavinash10/canteen_project_mobile_apps/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/tvavinash10/canteen_project_mobile_apps/issues/1/comments","events_url":"https://api.github.com/repos/tvavinash10/canteen_project_mobile_apps/issues/1/events","html_url":"https://github.com/tvavinash10/canteen_project_mobile_apps/issues/1","id":97610310,"number":1,"title":"Canteen_project_mobile_app","user":{"login":"tvavinash10","id":1397634,"avatar_url":"https://avatars.githubusercontent.com/u/1397634?v=3","gravatar_id":"","url":"https://api.github.com/users/tvavinash10","html_url":"https://github.com/tvavinash10","followers_url":"https://api.github.com/users/tvavinash10/followers","following_url":"https://api.github.com/users/tvavinash10/following{/other_user}","gists_url":"https://api.github.com/users/tvavinash10/gists{/gist_id}","starred_url":"https://api.github.com/users/tvavinash10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvavinash10/subscriptions","organizations_url":"https://api.github.com/users/tvavinash10/orgs","repos_url":"https://api.github.com/users/tvavinash10/repos","events_url":"https://api.github.com/users/tvavinash10/events{/privacy}","received_events_url":"https://api.github.com/users/tvavinash10/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-28T04:07:47Z","updated_at":"2015-07-28T04:07:47Z","closed_at":null,"body":"package com;\r\n\r\nimport java.io.IOException;\r\nimport java.util.ArrayList;\r\nimport org.apache.http.HttpResponse;\r\nimport org.apache.http.NameValuePair;\r\nimport org.apache.http.client.ClientProtocolException;\r\nimport org.apache.http.client.HttpClient;\r\nimport org.apache.http.client.entity.UrlEncodedFormEntity;\r\nimport org.apache.http.client.methods.HttpPost;\r\nimport org.apache.http.impl.client.DefaultHttpClient;\r\nimport org.apache.http.message.BasicNameValuePair;\r\nimport com.coderzheaven.gettablefromphp.R;\r\nimport android.app.Activity;\r\nimport android.app.ProgressDialog;\r\nimport android.os.AsyncTask;\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.view.View.OnClickListener;\r\nimport android.widget.Button;\r\nimport android.widget.EditText;\r\nimport android.widget.Toast;\r\n\r\npublic class SetDataToDb extends Activity implements OnClickListener {\r\n\tString item;\r\n\tString qty;\r\n\tButton button1;\r\n    EditText item_text,qty_text;\r\n\t@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.activity_set_data_to_db);\r\n\t\tbutton1 = (Button)findViewById(R.id.button1);\r\n\t\tbutton1.setOnClickListener(this);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void onClick(View arg0)\r\n\t\t{\r\n\t\t\tEditText editText = (EditText) findViewById(R.id.item);\r\n\t\t    item = editText.getText().toString();\r\n\r\n\t\t    EditText editText1 = (EditText) findViewById(R.id.qty);\r\n\t\t    qty= editText1.getText().toString();\r\n\r\n\t\tInsertData task1 = new InsertData();\r\n\t\ttask1.execute(new String[]{\"http://192.168.2.2/hackathon/Insert.php\"});\r\n\t\t\r\n\t\t//Intent in = new Intent(this, ReadDataActivity.class);\r\n\t\t//startActivity(in);\r\n\t}\r\n\t\r\n\tprivate class InsertData extends AsyncTask<String, Void, Boolean>{\r\n\t\tProgressDialog dialog = new ProgressDialog(SetDataToDb.this);\r\n\t\t@Override\r\n\t\tprotected void onPreExecute() {\r\n\t\t\tdialog.setMessage(\"Sending Data...\");\r\n\t\t\tdialog.show();\r\n\t\t}\r\n\r\n\t\t@Override\r\n\t\tprotected Boolean doInBackground(String... urls) {\r\n\t\t\tfor(String url1 : urls){\r\n\t\t\t\t\r\n\t\t\t\ttry {\r\n\t\t\t\t\tArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();\r\n\t\t\t\t\tpairs.add(new BasicNameValuePair(\"i\",item ));\r\n\t\t\t\t\tpairs.add(new BasicNameValuePair(\"q\", qty));\r\n\t\t\t\t\t\r\n\t\t\t\t\tHttpClient client = new DefaultHttpClient();\r\n\t\t\t\t\tHttpPost post = new HttpPost(url1);\r\n\t\t\t\t\tpost.setEntity(new UrlEncodedFormEntity(pairs));\r\n\t\t\t\t\t\r\n\t\t\t\t\tHttpResponse response = client.execute(post);\r\n\t\t\t\t\tresponse.toString();\r\n\t\t\t\t} catch (ClientProtocolException e) {\r\n\t\t\t\t\tToast.makeText(SetDataToDb.this, e.toString(), Toast.LENGTH_LONG).show();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tToast.makeText(SetDataToDb.this, e.toString(), Toast.LENGTH_LONG).show();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\t@Override\r\n\t\tprotected void onPostExecute(Boolean result) {\r\n\t\t\tif(result == true){\r\n\t\t\t\t\r\n\t\t\t\tToast.makeText(SetDataToDb.this, \"Insert Success\", Toast.LENGTH_LONG).show();\r\n\t\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tToast.makeText(SetDataToDb.this, \"Error\", Toast.LENGTH_LONG).show();\r\n\t\t\t}\r\n\t\t\tdialog.dismiss();\r\n\t\t}\r\n\t\t\r\n\t}\r\n\r\n}"}}