我尝试将服务器数据库与我的 Android 应用程序(php + mysql)连接。
当我 makeHttpRequest Logcat 显示类似“httphostconnectexception 连接到 http//localhost 被拒绝”时
我知道您已经被问过好几次了,我尝试修复它,但看到每个回复仍然不起作用。
重要: 1.“”在我的浏览器中有效,但在我的模拟器中无效。 两个。已经尝试过http://jsonlint.com json 对象并正确。
感谢您的关注!
protected String doInBackground(String... args)
{
List<NameValuePair> params = new ArrayList<NameValuePair>();
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest("http://10.0.2.2/test/get_all_users.php", "GET", params);
//......
}
最佳答案
您检查过互联网权限吗?如果可以,那么将您的 list 文件放在这里。
关于php - 在Android(模拟器)中连接服务器数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24385294/