code: package com.egreksystems.mailuber;
  
  import android.app.Application;
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.net.Socket;
  
  public class MainActivity extends AppCompatActivity {
  
      EditText etIP, etPort;
      //Thread Thread1 = null;
      String SERVER_IP;
      int SERVER_PORT;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          etIP = findViewById(R.id.etIP);
          etPort = findViewById(R.id.etPort);
  
          Button btnConnect = findViewById(R.id.btnConnect);
          btnConnect.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  SERVER_IP = etIP.getText().toString().trim();
                  SERVER_PORT = Integer.parseInt(etPort.getText().toString().trim());
  
                  Intent intent = new Intent(MainActivity.this, OrderRobot.class);
                  intent.putExtra("IP", SERVER_IP);
                  intent.putExtra("PORT", SERVER_PORT);
                  startActivity(intent);
                  finish();
  
              }
          });
      }
  
  }
  