To allow your application to connect to the internet first you need to do is to modify AndroidManifest.xml file to request INTERNET permission for your application.
To do this open AndroidManifest.xml file and add following line if not exists:
<
uses-permission
android:name
=
"android.permission.INTERNET"/
>
To connect to your local web server (localhost), you must use IP address of your computer instead of localhost keyword or 127.0.0.1 IP address. That's it because 127.0.0.1 IP address is internally used by android emulator or your android device. Somewhere I found that you can use 10.0.0.2 IP adress to connect to your local web server. I tried it but this not work for me. I think that this depends of type of web server you have installed. If you want to know more about connecting to the Internet from Android application you can read my blog entry: Android application and the Internet
To connect to your local web server (localhost), you must use IP address of your computer instead of localhost keyword or 127.0.0.1 IP address. That's it because 127.0.0.1 IP address is internally used by android emulator or your android device.
Somewhere I found that you can use 10.0.0.2 IP adress to connect to your local web server. I tried it but this not work for me. I think that this depends of type of web server you have installed.
If you want to know more about connecting to the Internet from Android application you can read my blog entry: Android application and the Internet
Blog about programming
Great information you got here. I've been reading about this topic for one week now for my papers in school and thank God I found it here in your blog. I had a great time reading this.
I can't connect to your entry Android application and the Internet
I saw your entry& thanks for ur info
The correct IP address to use to talk to the host running the emulator is 10.0.2.2. I've abstracted communication with a webserver in my app behind this little nugget:<br /><br />public static boolean isEmulator() <br />{<br /> if (isDebug == null)<br /> {<br /> isDebug = "google_sdk".equals(Build.PRODUCT) || <br /> "sdk".equals(Build.PRODUCT);<br /> }<br /> return isDebug;<br />}<br /> <br />public static String getServerUrl()<br />{<br /> return (isEmulator() ? Constants.SERVER_URL_TEST : Constants.SERVER_URL_PUBLIC);<br />}<br />
plz...help me
we are created one android app<br />this application should display marks of attendace stored in website,<br />so how to retrieve marks from my app<br />plz.. help me
We'll guide you through the process of incorporating ChatGPT shared links into your commit messages.
What you should know abot textures before get started programming your first game.
GIMP script for creating Android icons at once
Script for creating Android icons for different screen resolutions at once. Icons can be saved using standard Android icons naming conventions and saved in appropriate folders.
Source code with examples how to use relative layout to create nice buttons with text and images in Android
Tutorial about connecting to the web pages on the Internet from Android application, using both POST and GET web requests.