-2

I am trying to workout a form design in android (eclipse ide) for phone book function using mysql database and php serverside coding.

My doubt is where to create.php file in xampp/htdocs folder. i have created a custom folder and placed .php file. ?

What will be the ip address to be mentioned in the MainActivity.java file in http connection part?

i have done all possible actions through internet answers but the while clicking submit button in android form no response from the avd.

my error log is below

  11-28 15:26:47.012: E/WindowManager(865): android.view.WindowLeaked: Activity       com.example.phonebook.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{1112109d V.E..... R.....ID 0,0-229,175} that was originally added here
  11-28 15:26:47.012: E/WindowManager(865):     at android.view.ViewRootImpl.<init>(ViewRootImpl.java:363)
  11-28 15:26:47.012: E/WindowManager(865):     at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:261)
  11-28 15:26:47.012: E/WindowManager(865):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
  11-28 15:26:47.012: E/WindowManager(865):     at android.app.Dialog.show(Dialog.java:298)
  11-28 15:26:47.012: E/WindowManager(865):     at com.example.phonebook.MainActivity$loginAccess.onPreExecute(MainActivity.java:111)
  11-28 15:26:47.012: E/WindowManager(865):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587)
  11-28 15:26:47.012: E/WindowManager(865):     at android.os.AsyncTask.execute(AsyncTask.java:535)
  11-28 15:26:47.012: E/WindowManager(865):     at com.example.phonebook.MainActivity$2.onClick(MainActivity.java:84)
  11-28 15:26:47.012: E/WindowManager(865):     at android.view.View.performClick(View.java:4756)
  11-28 15:26:47.012: E/WindowManager(865):     at android.view.View$PerformClick.run(View.java:19749)
  11-28 15:26:47.012: E/WindowManager(865):     at android.os.Handler.handleCallback(Handler.java:739)
  11-28 15:26:47.012: E/WindowManager(865):     at android.os.Handler.dispatchMessage(Handler.java:95)
  11-28 15:26:47.012: E/WindowManager(865):     at android.os.Looper.loop(Looper.java:135)
  11-28 15:26:47.012: E/WindowManager(865):     at android.app.ActivityThread.main(ActivityThread.java:5221)
  11-28 15:26:47.012: E/WindowManager(865):     at java.lang.reflect.Method.invoke(Native Method)
  11-28 15:26:47.012: E/WindowManager(865):     at java.lang.reflect.Method.invoke(Method.java:372)
  11-28 15:26:47.012: E/WindowManager(865):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
  11-28 15:26:47.012: E/WindowManager(865):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

 httpclient=new DefaultHttpClient();
        httppost= new HttpPost("http://127.0.0.1:8080/crm/check.php"); // make sure the url is correct.

i tried changing the url for httppost connection. but the result is no response from server.

aanagan
  • 1
  • 2
  • possible duplicate of [How to connect Android app to MySQL database?](http://stackoverflow.com/questions/15732853/how-to-connect-android-app-to-mysql-database) – Jibran Khan Nov 28 '14 at 10:15
  • This is what you're looking for : http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ – Farouk Touzi Nov 28 '14 at 10:18

2 Answers2

1

this crash is due to the dialog box which is displayed during http connection you are not passing the proper context or issue is related to the dialog box for sure if you paste the code i can help

0

What will be the ip address to be mentioned in the MainActivity.java file in http connection part?

Ans: do ifconfg commmand if you are using linux and you will get the ipaddress ex ::192.168.1.101. This will be your localhost and you can give the link of the php file with this. ex :http://192.168.1.101/API/check.php where the connection is written in check.php

John Simon
  • 818
  • 11
  • 25