Here is the error: request time failed: java.net.SocketException: Address family not supported by protocol

and here is the code:

public class LoginPage extends Activity { protected void OnCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_layout); final EditText account = (EditText) findViewById(R.id.editText1); final EditText Login = (EditText) findViewById(R.id.editText2); final EditText Password = (EditText) findViewById(R.id.editText3); // ProgressBar Progress = (ProgressBar) findViewById(R.id.progress); Button butlogin = (Button) findViewById(R.id.button1); butlogin.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getBaseContext(), "Please wait, connecting to server.", Toast.LENGTH_LONG) .show(); try { HttpClient Client = new DefaultHttpClient(); String URL = "http://" + account + ".megaplan.ru/" + Login + "&password" + Password; Log.i("httpget", URL); try { String SetServerString = ""; HttpGet httpget = new HttpGet(URL); ResponseHandler<String> responseHandler = new BasicResponseHandler(); SetServerString = Client.execute(httpget, responseHandler); } catch (IOException e) { Log.i("Exception", "Exception:" + e); } finally { } } finally { }}});}} 

If the code is not working, then at least the form should open, but it does not open ...

    1 answer 1

    In the manifest there is a string like

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

    ?

    And the second is on Android 4, how to do network requests with gui is not accepted, it will be cursed strongly.

    • No, there is no this line in the manifest :( - Imire
    • And with it and without it does not work. I'm testing on 2.3.3 version and on 3 android. - Imire
    • then still logcat needs to be shown. - KoVadim
    • My layout didn't start. I did not find the reasons, just deleted the old one and created a new one. And it all worked. Now my request is sent to where it is))) - Imire