2016-04-03 32 views
0

Merhaba Android Studio bu kodu var olmasıdırAndroid Studio OnPostExecute Sonuç

G/System.out: onPostExecute :::::::::::::::::::::::::: 04-03 18: 25: 50.798 18046-18046/com.example.lorenzo. phpmysql I/System.out:

Benim php kodum Tamam, Hiç bir hatam veya bunun gibi bir şeyim yok!

Neden olduğunu biliyor musunuz?

Çok teşekkürler!

+0

Mesaj kaynağıdır 'downloadURL (...)', sorun büyük olasılıkla orada yatıyor. –

cevap

0

Bu benim downloadURL

private String downloadUrl(String myurl) throws IOException { 
    Log.i("URL",""+myurl); 
    myurl = myurl.replace(" ","%20"); 
    InputStream is = null; 
    // Only display the first 500 characters of the retrieved 
    // web page content. 
    int len = 500; 

    try { 
     URL url = new URL(myurl); 
     HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 
     conn.setReadTimeout(10000 /* milliseconds */); 
     conn.setConnectTimeout(15000 /* milliseconds */); 
     conn.setRequestMethod("GET"); 
     conn.setDoInput(true); 
     // Starts the query 
     conn.connect(); 
     int response = conn.getResponseCode(); 
     Log.d("respuesta", "The response is: " + response); 
     is = conn.getInputStream(); 



     // Convert the InputStream into a string 
     String contentAsString = readIt(is, len); 
     return contentAsString; 

     // Makes sure that the InputStream is closed after the app is 
     // finished using it. 
    } finally { 
     if (is != null) { 
      is.close(); 
     } 
    } 
} 

public String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException { 
    Reader reader = null; 
    reader = new InputStreamReader(stream, "UTF-8"); 
    char[] buffer = new char[len]; 
    reader.read(buffer); 

    return new String(buffer); 
}