я хочу создать веб-сервис, с помощью PHP кода, PHP файл, содержащий текст, и я хочу показать этот текст Android textVeiwAndroid Webservices с PHP
I соединение с URL через OpenConnection(), но у меня есть ошибка в классе InputStreamReader
public class MainActivity extends AppCompatActivity {
TextView text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView) findViewById(R.id.textView4);
}
public void onClick(View view) throws Exception {
URL hellofileurl = null;
try {
hellofileurl = new URL("http://waaddev.ahosti.net/web.php");
HttpURLConnection myfirstconnection = (HttpURLConnection) hellofileurl.openConnection();
InputStream stream = new InputStream(myfirstconnection.getInputStream());//i have error in this line
BufferedReader b = new BufferedReader(stream);
String hello = b.readLine();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Какой тип исключения вы получаете? Пожалуйста, укажите немного больше информации ... – Fortega