1 package com.local.cinermt;
3 import android.app.Activity;
4 import android.content.Intent;
5 import android.os.Bundle;
6 import android.view.Menu;
7 import android.view.MenuItem;
8 import android.view.View;
9 import android.view.View.OnClickListener;
10 import android.widget.Button;
11 import android.widget.EditText;
13 public class ConfigActivity extends Activity implements OnClickListener {
17 EditText etxt_ip_addr;
22 protected void onCreate(Bundle b) {
25 Intent it = getIntent();
26 ip_addr = it.getStringExtra("IP_ADDR");
27 pin = it.getStringExtra("PIN");
28 port = it.getIntExtra("PORT",0);
30 setContentView(R.layout.activity_config);
31 etxt_ip_addr = (EditText)findViewById(R.id.ip_addr);
32 etxt_pin = (EditText)findViewById(R.id.pin);
33 etxt_port = (EditText)findViewById(R.id.port);
35 etxt_ip_addr.setText(ip_addr);
36 etxt_pin.setText(pin);
37 etxt_port.setText(String.format("%d", port));
39 Button btn = (Button)findViewById(R.id.back);
40 btn.setOnClickListener(this);
44 public boolean onCreateOptionsMenu(Menu menu) {
45 getMenuInflater().inflate(R.menu.menu_main, menu);
50 public void onClick(View v) {
51 if (v instanceof Button) {
52 int id = ((Button)v).getId();
53 if (id == R.id.back) {
54 ip_addr = etxt_ip_addr.getText().toString();
55 pin = etxt_pin.getText().toString();
57 port = Integer.valueOf(etxt_port.getText().toString());
58 } catch(Exception e) { port = 0; }
60 Intent it = new Intent(this,MainActivity.class);
61 it.putExtra("IP_ADDR", ip_addr);
62 it.putExtra("PIN", pin);
63 it.putExtra("PORT", port);
71 public boolean onOptionsItemSelected(MenuItem item) {
72 super.onOptionsItemSelected(item);
73 int id = item.getItemId();
74 if (id == R.id.menu_exit) {