Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to pass the result of one edittext to another edittext?
    primarykey
    data
    text
    <p>How do I pass the result of one edittext to another edittext? This is my example code of one edittext:</p> <pre><code>String a,b,c,d; Integer vis; a = txtbox1.getText().toString(); b = txtbox2.getText().toString(); c = txtbox3.getText().toString(); d = txtbox4.getText().toString(); vis = Integer.parseInt(a)*2+Integer.parseInt(b)*3+Integer.parseInt(c)*4+Integer.parseInt(d)*5; tv.setText(vis.toString()); </code></pre> <p>And I want the value of <code>tv.setText(vis.toString());</code> will be transferred to another one edittext which I will be using to be an input on my Asynctask (Server-Client communication). </p> <p>Can anyone help me?</p> <p>Asynctask:</p> <pre><code>public class ConnectToServerTask extends AsyncTask&lt;View, Integer, Socket&gt; { private static final String IP_ADDRESS = "192.168.1.110"; // Kerv Server private static final int DEST_PORT = 1234; //port that is used private EditText kaboom; /** * Store provided views (used later in onPostExecute(...)). * * Create socket to communicate with server (blocking call). */ protected Socket doInBackground(View... params) { // Store provided views. if (params.length != 1) throw new IllegalArgumentException(); kaboom = (EditText) params[0]; // Create socket. Socket client = null; try { client = new Socket(IP_ADDRESS, DEST_PORT); // connect to server } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return client; } /** * Write to server. */ protected void onPostExecute(Socket client) { try { PrintWriter printwriter; String messsage; messsage = kaboom.getText().toString(); // get the text message on the text field kaboom.setText(null); // Reset the text field to blank printwriter = new PrintWriter(client.getOutputStream(), true); printwriter.write(messsage); // write the message to output stream printwriter.flush(); printwriter.close(); client.close(); } catch (IOException e) { e.printStackTrace(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload