I am developing and android app which posts data collected from text boxes in android to a PHP/MySQL database located on uhostfull.com.Now when I am trying to display data from database in JSON format.But neither the request call nor displaying data not working.The code is`
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
public class MainActivity extends ActionBarActivity {
TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
display = (TextView) findViewById(R.id.textview1);
String url = "http://xxxxxx.uhostfull.com/get_all.php";
RequestQueue request= Volley.newRequestQueue(this);
StringRequest strrequest =new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
display.setText(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
display.setText("that didn't work");
}
});
request.add(strrequest);
}
}`
And also I need to send data to a PHP script which inserts into Mysql database.How should I do it.I tried HttpUrlConnection also but data is not transferring.The response is that the POST parameters are empty.How should I solve all these problems???