php - Android failed to connect to database -


i new in android, wanna connect android app mysql database via php (i use mamp-pro create database). don't know why response failed. in php file, insert new record in database table, doesn't add new record database. here code:

okhttpclient client = new okhttpclient();     file cachedirectory = new file(this.getcachedir(),"http");     int cachesize = 10 * 1024 * 1024;     cache cache = new cache(cachedirectory, cachesize);     client.setcache(cache);     request request = new request.builder().url("http://localhost:8888/myfirstphp.php").build();      client.newcall(request).enqueue(new callback() {         @override         public void onfailure(request request, ioexception e) {             updatetextview1();         }          @override         public void onresponse(response response) throws ioexception {             if (response.code() >= 200 || response.code() <= 300){                 responsebody responsebody = response.body();                 inputstream inputstream = responsebody.bytestream();                 updatetextview();             }          }     }); 


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -