Apache and android connection problem

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Apache and android connection problem

Postby IdoMajorVA41 » Thu Mar 14, 2013 7:34 pm

Hi whatsup?
i have set on my laptop apache v7 server which is running on port 80
and all i did in the doGet function is:
PrintWriter writer = response.getWriter();
writer.println("Hello Android!!!");
in the android application i made a URL like this :
private final String URL = "";

the program that runs in the server called Tirgol and there is a servlet named main and all he does is the top code in this comment
When i try to open a connection in the browser with one of these:

i can see the apache page.
when i try to connect to the apache server from an android emulator it doesnt work
the code i did in android is :

public class MainActivity extends Activity {

TextView header;
Button connect;
private final String URL = "";
protected void onCreate(Bundle savedInstanceState) {
header = (TextView) findViewById(R.id.header);
connect = (Button) findViewById(R.id.button1);
connect.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
String output = " bye";
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(URL);

HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
output = EntityUtils.toString(httpEntity);
} catch (Exception e) {

Every time i do press the connect button i get "" - which means i get nothing back and i am getting crazy about because i doing every step by the manual :)
And i did use the INTENET premission in the manifest
Please help me and Thanks
Once Poster
Once Poster
Posts: 1
Joined: Thu Mar 14, 2013 7:24 pm


Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 2 guests