0
Как вы думаете, а почему этот код не соответствует? Я использую этот класс: https://github.com/btouchard/HttpData/blob/master/README.mdНе удалось выполнить способ действия httpdata
Ошибка:
java.lang.IllegalStateException: Could not execute method of the activity
Location of error: Log.i line!
Спасибо за помощь. Я думаю, это базовое решение, но я не могу его найти.
public class Formulaire extends Activity {
EditText msgTextField;
Button sendButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.form);
//make message text field object
msgTextField = (EditText) findViewById(R.id.msgTextField);
//make button object
sendButton = (Button) findViewById(R.id.sendButton);
}
public void send(View v) {
//get message from message box
try {
String MonURL = "http://www.davidmarchioni.fr/glopper/test.txt";
HttpData request = new HttpData(MonURL);
request.header(MonURL);
String html = request.asString();
Thread.sleep(2600);
Log.i("OK >> ", html);
Toast.makeText(getApplicationContext(), html, Toast.LENGTH_SHORT).show();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Если вызов 'Log.i()' бросает «Исключение», то «html», вероятно, «null». –