You have to simply add the following line in file manifest.xml after the manifest tag
<uses-permission android:name="android.permission.INTERNET"/>
And in the activity file, add the following code after the binding statement:
if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);}