Search This Blog

Tuesday, August 8, 2017

Android to Mysql via Php API using the Model/Fragment/Adapter architecture

Recently I was building an android app and there was a requirement to connect to MYSQL database from Android code, so I created a simple table in my mysql and wrote a few lines to PHP code to insert the data in my table. I had to invoke this php code from my Android fragment and show an alert dialog box.

I will explain you how to write this in the Fragment.

You should never do http based call  or networking calls on main activity and you are supposed to write an Async task for this.