与本地主机服务器的Andr​​oid设备连接

问题描述:

我是新的机器人。我发民是使用MySQL的应用程序。该应用程序在模拟器中运行良好。但现在我需要在Android设备上运行的应用程序。我能做些什么。

I am new at android. I am devloping an app that uses MySQL. The application runs well in the emulator. But now I need to run the app in a android device. What can I do.

我用

private static String gethall = "http://10.0.2.2/theater_details/theater.php";

我能做些什么?

What can I do??

作为第一个注释说明,你应该检查你的文件的Andr​​oidManifest.xml。

As stated in the first comment, you should check your file AndroidManifest.xml.

为了访问网络,它应该包含以下说明:

In order to access the network, it should contain the following instructions :

<uses-permission android:name="android.permission.INTERNET" />

您也可以添加以下,这使应用程序可以知道网络连接的实际状态。

You may also add the following, which enable your application to know the actual state of the network connection.

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />