eclipse - Android post innexplicable error -


i trying post user , password php file situated on remote server , android gives me exception not understand.

i mean, code looks this:

string url_connect = "http://myhost.com/mylogin.php"; boolean result_back;  public boolean loginstatus(string username ,string password ) {   int logstatus=-1;   arraylist<namevaluepair> postparameters2send= new arraylist<namevaluepair>();   postparameters2send.add(new basicnamevaluepair("uzer",username));   postparameters2send.add(new basicnamevaluepair("pass",md5(password)));   jsonarray jdata=post.getserverdata(postparameters2send, url_connect);   ... more code here } 

and error in logcat

error in http connection: java.net.unknownhostexception: myhost.com 

but problem is... if copy entire url_connect string declared above, , paste browser... works fine. why eclipse throw me error?

how can fix this?

my androidmanifest.xml is:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.mysoft.mydualscreenpro"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="8"         android:targetsdkversion="17" />      <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >         <activity             android:name="com.mysoft.mydualscreenpro.mainactivity"             android:label="@string/app_name" >             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>         <activity             android:name="com.mysoft.mydualscreenpro.mynewscreen"             android:label="@string/title_activity_my_new_screen" >         </activity>     </application>  </manifest> 

make sure added internet permission in androidmanifest file, otherwise android won't let application access internet , throw excception.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -