i am trying to fetch data from php, problem which i am facing is when data is huge only half of the values has been received at the android end, while if i call only php page from browser it gives me the complete value.
Here is code, this works for small set of data values, at it doesnot gives the complete result.
Call to asyncTalk for fetching data from server
DownloadMenu loadData = new DownloadMenu(AdminOperationActivity.this);
loadData.execute(ServerPath+"data.php");
public class DownloadMenu extends AsyncTask<String, Void, String>
{
ProgressDialog pd;
Context context;
public DownloadMenu(Context context) {
this.context = context;
pd = new ProgressDialog(context);
}
@Override
protected void onPreExecute(){
pd.setMessage("Please wait Downloading Menu...");
pd.setCancelable(false);
pd.show();
}
@Override
protected String doInBackground(String... urls) {
// TODO Auto-generated method stub
String output = null;
for (String url : urls) {
output = getOutputFromUrl(url);
}
return output;
}
@Override
protected void onPostExecute(String output)
{
if (pd.isShowing()) {
pd.dismiss();
}
}
private String getOutputFromUrl(String url) {
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
1);
nameValuePairs.add(new BasicNameValuePair("hid", edHotelId.getText().toString().trim()));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = httpClient.execute(httpPost,
responseHandler);
Log.d("Hotel Menu Output",responseBody);
return url;
}
}