I am really confused as to why I am having this problem. I am very new to android development so I am not really sure where to start when solving this problem. I have all the required permissions in the manifest file. <uses-permission android:name="android.permission.INTERNET" />
and <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
.
When a button is pressed myClickHandler
is called and creates a URL with the two EditText
's. After it does that it calls downloadWebPageTask
which starts an ASyncTask. This AsyncTank takes the URL and then sends GET request. Here is my code.
public void myClickHandler(View view) {
SetText url = new SetText();
String stringUrl = url.createURL(artist_text.getText().toString(), release_text.getText().toString());
new DownloadWebpageTask().execute(stringUrl);
}
public class DownloadWebpageTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
// params comes from the execute() call: params[0] is the url.
//SendStuff send = new SendStuff("mrblahblahblacksheep");
//return send.sendGet(urls[0]);
String url = urls[0];
String final_response = "FAILED!";
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response;
try {
response = client.execute(request);
final_response = response.toString();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return final_response;
}
// onPostExecute displays the results of the AsyncTask.
@Override
protected void onPostExecute(String result) {
result_text.setText(result);
}
}
Every time I press the button in the Emulator the app crashes. None of the crash data is saved in the logcat so I am unsure as to wear to find out the reasons for the crash.