src/com/benito/udpterminal/TerminalUDPActivity.java
/** Called when the activity is first created. */
Called when the activity is first created.
Called when the activity is first created .
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final EditText edLporta = (EditText) findViewById(R.id.editTextLocalPort);
        final EditText edIP = (EditText) findViewById(R.id.editTextIp);
        final EditText edPorta = (EditText) findViewById(R.id.editTextPorta);
        final EditText edPayload = (EditText) findViewById(R.id.editTextPayload);
        final Button btSend = (Button) findViewById(R.id.buttonSend);
        btSend.setOnClickListener(new OnClickListener() {
        	public void onClick(View v) {
        		String texto = edIP.getText()+":"+edPorta.getText()+
        		               " - Payload: "+edPayload.getText();
        		Toast.makeText(TerminalUDPActivity.this, "enviando:\n"+texto ,Toast.LENGTH_LONG).show();
        		int port = Integer.parseInt(edPorta.getText().toString());
        		int lport = Integer.parseInt(edLporta.getText().toString());
        		try {
					sendPacket(lport,edIP.getText().toString(), port, edPayload.getText().toString());
				} catch (IOException e) {
					e.printStackTrace();
				}
        	}
        });
    }
@ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . main ) ; final EditText edLporta = ( EditText ) findViewById ( R . id . editTextLocalPort ) ; final EditText edIP = ( EditText ) findViewById ( R . id . editTextIp ) ; final EditText edPorta = ( EditText ) findViewById ( R . id . editTextPorta ) ; final EditText edPayload = ( EditText ) findViewById ( R . id . editTextPayload ) ; final Button btSend = ( Button ) findViewById ( R . id . buttonSend ) ; btSend . setOnClickListener ( new OnClickListener ( ) { public void onClick ( View v ) { String texto = edIP . getText ( ) + ":" + edPorta . getText ( ) + " - Payload: " + edPayload . getText ( ) ; Toast . makeText ( TerminalUDPActivity . this , "enviando:\n" + texto , Toast . LENGTH_LONG ) . show ( ) ; int port = Integer . parseInt ( edPorta . getText ( ) . toString ( ) ) ; int lport = Integer . parseInt ( edLporta . getText ( ) . toString ( ) ) ; try { sendPacket ( lport , edIP . getText ( ) . toString ( ) , port , edPayload . getText ( ) . toString ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } ) ; }
Called when the activity is first created.
Called when the activity is first created .
// TODO Auto-generated catch block