Hi I am trying to read from a simple database created in NetBeans into my app on android studio but I keep getting java.net.SocketTimeoutException: Read timed out error on execute. I have my XmlReaderTask class which uses AsyncTask and Retrofit as shown:
public class XmlReaderTask extends AsyncTask<Void, Void, String> {
TableList tableList = new TableList();
String responseText;
Handler handler;
TextView textView;
protected String doInBackground(Void... voids) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://10.0.2.2:8080/WebbTest2/webresources/")//http://10.0.2.2:8080/WebbTest2/webresources/se.miun.register?
.addConverterFactory(SimpleXmlConverterFactory.create())
.build();
NameService service = retrofit.create(NameService.class);
Call<TableList> listName = service.listNames();
try {
Response<TableList> result = listName.execute();
TableList tableList = result.body();
responseText = tableList.register.get(0).name;
} catch (IOException e) {
e.printStackTrace();
}
return responseText;
}
protected void onPostExecute(String result) {
handler.post(new Runnable() {
@Override
public void run() {
if(responseText!=null)
textView.setText(responseText);
}
});
}
I am new to programming in android studio and I can't see what the mistake is, any ideas?