Here is my code 

```
package com.example.akash.myapplication;
//Required import files here
public class MainActivity extends Activity implements Runnable
{
public TextView tex;
public Button button;
public EditText edi;
public static Socket client;
String serverName = "192.168.0.100";
int port = 4444;

protected void onCreate(Bundle savedValues) {
    button= (Button) findViewById(R.id.button1);
    tex= (TextView) findViewById(R.id.textView1);
    edi= (EditText) findViewById(R.id.editText1);
    Runnable r = new MainActivity();
    final Thread t= new Thread(r);
    t.start();
    // Register the onClick listener with the implementation above
    button.setOnClickListener(new OnClickListener() {
        public void onClick(View v){

            try {

                t.wait();
                /*System.out.println("Enter your name: ");
                Scanner sc = new Scanner(System.in);
                String name = sc.nextLine();
                System.out.println("Connecting to " + serverName + " on port " + port);*/
                client = new Socket(serverName, port);

                //System.out.println("Just connected to " + client.getRemoteSocketAddress());
                OutputStream outToServer = client.getOutputStream();
                DataOutputStream out = new DataOutputStream(outToServer);

                out.writeUTF("Hello from " + client.getLocalSocketAddress());
                String msg = edi.getText().toString();
                out.writeUTF("Client: " + msg);
                t.run();

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

public void run()
{
    while(true)
    {
        try
        {

            client = new Socket(serverName, port);
            if(client.getInputStream()!=null){
            InputStream inFromServer = client.getInputStream();
            DataInputStream in =  new DataInputStream(inFromServer);
                tex.append("Server: " + in.readUTF() + "\n");}
            client.close();
        }catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}

public void test(){
// Acquire a reference to the system Location Manager
    LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
    tex.setText("inside test");
    /*String locationProvider = LocationManager.GPS_PROVIDER;
    Location lastKnownLocation = locationManager.getLastKnownLocation(locationProvider);
    t.setText("Latitude: " + lastKnownLocation.getLatitude());*/
// Define a listener that responds to location updates
    LocationListener locationListener = new LocationListener() {
        public void onLocationChanged(Location location) {
            // Called when a new location is found by the network location provider.
            double d = location.getLatitude();
            tex.setText("Latitude: " + d);

        }

        public void onStatusChanged(String provider, int status, Bundle extras) {}

        public void onProviderEnabled(String provider) {}

        public void onProviderDisabled(String provider) {}
    };

// Register the listener with the Location Manager to receive location updates
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
}

```

}

And here is the null pointer error, which I guess is being caused in the run() method. I've been trying to fix this bug since more than couple hours now but all in vain.

```
01-07 09:05:35.178  28413-28413/com.example.akash.myapplication W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4187fc08)
01-07 09:05:35.183  28413-28413/com.example.akash.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.akash.myapplication, PID: 28413
android.util.SuperNotCalledException: Activity {com.example.akash.myapplication/com.example.akash.myapplication.MainActivity} did not call through to super.onCreate()
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
        at android.app.ActivityThread.access$900(ActivityThread.java:175)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:146)
        at android.app.ActivityThread.main(ActivityThread.java:5603)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
        at dalvik.system.NativeStart.main(Native Method)

```

I'd really appreciate your help people.
If possible, please share some references or guide me anyway using which I can solve these problems myself and also help others in this great community.
Thankyou in advance.

Updated, the error is smaller now after following @M D