0

I dont know how to config them. I'm new dev.

This is error in Logcat

05-29 09:20:08.217: E/log_tag(1430): Error in http connection java.net.UnknownHostException: Unable to resolve host "myhostname.com": No address associated with hostname
05-29 09:20:08.217: E/log_tag(1430): Error converting result java.lang.NullPointerException
05-29 09:20:08.245: W/EGL_emulation(1430): eglSurfaceAttrib not implemented
05-29 09:20:08.257: D/OpenGLRenderer(1430): TextureCache::get: create texture(0xb7f752e0): name, size, mSize = 35, 61440, 1200228
05-29 09:20:08.257: E/log_tag(1430): Error parsing data org.json.JSONException: End of input at character 0 of

This is "MainActivity.java". I just change my host name.

           @Override
        protected Void doInBackground(String... params) {
          String url_select = "http://myhostname.com/ad/demo.php";

          HttpClient httpClient = new DefaultHttpClient();
          HttpPost httpPost = new HttpPost(url_select);

demo.php

<?php
mysql_connect("localhost","root","") or  die(mysql_error());
mysql_select_db("myDB");
$sql=mysql_query("select * from demo");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
print(json_encode($output));
mysql_close();
?>

I do From enter link description here

Amin
  • 1
  • 2
  • are you checking over localhost machine? put your IP address instead myhostname.com – Saqib May 29 '14 at 10:25
  • are you add internet permission on AndroidManifest.xml file? – Shijil May 29 '14 at 10:38
  • 1
    check your connection by loading this url on device browser – Shijil May 29 '14 at 10:45
  • Please be aware that the mysql extension (supplying the mysql_ functions) has been deprecated since 2012, in favor of the mysqli and PDO extensions. It's use is highly discouraged. See http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php – Oldskool May 29 '14 at 12:16

1 Answers1

0

The app just can't find your url_select-Adress. Because myhostname.com doesn't exist. So it's impossible to connect to this adress. Try to use XAMPP. It generates an own server on your computer to which you can connect.

Björn
  • 608
  • 2
  • 7
  • 19