title: Receiving files from Java server to Android. accept() not working
body: <p>Hi guys I'm creating simple interactive android application. Server runs Java. 
  It turns out, that I can not receive files from server.</p>
  
  <p>Android code is following</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  public DataReceiving dataReceiving;
  public DataTransfer dataTransfer;
  private EditText inputData;
  private Button sendParameters;
  private Button startComputation;
  public TextView displayText;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      inputData= (EditText) findViewById(R.id.editText1);
      sendParameters=(Button) findViewById(R.id.button1);
      startComputation=(Button) findViewById(R.id.button2);
      displayText=(TextView) findViewById(R.id.textView1);
  
  
  
  
      startComputation.setOnClickListener(new OnClickListener() {     
  
          public void onClick(View v) {
              String numberOfGates=inputData.getText().toString();
              ArrayList send=new ArrayList();
              send.add(numberOfGates);                
              dataTransfer=new DataTransfer();
              dataTransfer.execute(send);
  
          }
      });
  
      sendParameters.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              dataReceiving=new DataReceiving();
              dataReceiving.execute();
          }
      });
  
  }
  public  class DataReceiving extends AsyncTask&lt;Void, Void, ArrayList&gt;
  {
  
      @Override
      protected ArrayList doInBackground(Void... params) {
          ArrayList receivedData=new ArrayList();
          Log.i("DataReceiving", "doInbackgroung works");
          try {
              receivedData=receive();
          } catch (ClassNotFoundException e) {
              Log.e("DataReceiving", "Problems with receive method. Issue with class");
              e.printStackTrace();
          } catch (IOException e) {
              Log.e("DataReceiving", "Problems with receive method. Issue with IO");
              e.printStackTrace();
          }
          return receivedData;
      }
  
      @Override
      protected void onPostExecute(ArrayList result) {
            super.onPostExecute(result);
            displayText.setText(result.toString());
  
          }
  
  
  }
  
  
  public ArrayList receive () throws IOException, ClassNotFoundException
      {
          Log.i("receive method", "works");
          ServerSocket s= new ServerSocket(8888);
          Log.i("receive method", "ServerSocket(8888)");
          Socket incoming =s.accept();
          Log.i("receive method", "accept()");
          ObjectInputStream ios = new ObjectInputStream(incoming.getInputStream());
          Log.i("receive method", "ios");
          ArrayList b=new ArrayList();
          b = (ArrayList) ios.readObject();               
          Log.i("receive method", "data were received");
          ios.close();
          incoming.close();
          s.close();
          return b;
      }
  
  
  
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  </code></pre>
  
  <p>Here is the Log</p>
  
  <pre><code>06-18 18:08:51.709: D/dalvikvm(2160): GC_CONCURRENT freed 69K, 7% free 2760K/2952K, paused 78ms+85ms, total 261ms
  06-18 18:08:52.079: D/gralloc_goldfish(2160): Emulator without GPU emulation detected.
  06-18 18:09:05.090: I/DataReceiving(2160): doInbackgroung works
  06-18 18:09:05.099: I/receive method(2160): works
  06-18 18:09:05.099: I/receive method(2160): ServerSocket(8888)
  </code></pre>
  
  <p>It seems like Socket incoming =s.accept(); doesn't work and I have no idea why</p>
  
  <p>Here is Manifest file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.androidapp"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-sdk
      android:minSdkVersion="8"
      android:targetSdkVersion="17" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
          android:name="com.example.androidapp.MainActivity"
          android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>Server side is very simple</p>
  
  <pre><code>Socket s=new Socket("192.168.1.110", 8888);
  ObjectOutputStream oos=new ObjectOutputStream(s.getOutputStream());
  ArrayLIst b = new ArrayList();
  b.add("It Works");
  oos.writeObject(b);
  oos.close();
  s.close();
  </code></pre>
  
  <p>I will be very appreciated for any Ideas, how to fix this problem. Thank you </p>