Android do in background probelm
<pre><code>package com.example.handy;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.OutputStream;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.NoSuchElementException;
import java.util.Scanner;

import android.R.integer;
import android.app.Activity;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.provider.ContactsContract;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity
{

    private EditText ipaddress;
    private Button connect;
    private Button wipe;
    private static String myIp;



    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        StrictMode.ThreadPolicy policy = new StrictMode.
        ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy); 



        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ipaddress = (EditText) findViewById(R.id.ipaddress_felid);

        connect = (Button) findViewById(R.id.connect);
        wipe =(Button) findViewById(R.id.wipe);



        //Button press event listener
        connect.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View v)
             {
                 setMyIp(ipaddress.getText().toString());
                // myComs.sending_data(getMyIp() , "Got connected");
                try
                 {

                    InetAddress inet = InetAddress.getByName(getMyIp());
                    Socket s = new Socket(inet, 2000);
                    new Incomingdata(s).execute();
                    OutputStream o = s.getOutputStream();
                    PrintWriter p = new PrintWriter(o);





                     p.println("You are connected");
                     p.flush();

                     readContacts();
                     readSms();




                 }



                 catch (UnknownHostException e) 
                 {
                    ipaddress.setText("Unknown host");
                       e.printStackTrace();
                 }
                catch (IOException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }



             }


         });
        wipe.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View v)
             {
                String kill = "5";
                 myComs.sending_data(MainActivity.getMyIp(), kill);
                 finish();

             }
             });
    }
public class Incomingdata extends AsyncTask&lt;Void,Void,Void&gt;
{
    Socket s ;
    String input;

    public Incomingdata(Socket socket)
    {
        super();
        this.s = socket;
    }


    @Override
    protected Void doInBackground(Void... params) 
    {
        try
        {   
            InputStream in = s.getInputStream();
            Scanner r = new Scanner(in);
            while(s.isConnected()&amp;&amp; r.hasNext())
            {
                String input =r.nextLine();

            }

        }
        catch (UnknownHostException e) 
        {
            ipaddress.setText("Unknown host");
               e.printStackTrace();
        }
        catch (IOException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        catch(NoSuchElementException e)
        {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(Void input)
    {
        System.out.println(""+input);
    }

}
</code></pre>

<p>I have no errors and its not crashing buts its not listening to my incoming message coming in and it is not displaying it </p>

<p>I am a bit lost since i am new to this but at insight would be great thank you!!</p>
