0

次の layoutPage/Activity で単純な Employee レコードを表示したいだけです!!

これは私の EmpLogin Java ファイルです

public class EmpLogin extends Activity {

private Button show;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.test);
    // TODO Auto-generated method stub

    show=(Button)findViewById(R.id.show);

    show.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub

            EditText no=(EditText)findViewById(R.id.getno);

            EditText name=(EditText)findViewById(R.id.getname);

            EditText sal=(EditText)findViewById(R.id.getsalary);

        Intent emp = new Intent(getApplicationContext(),EmpShow.class);


            emp.putExtra("EmpNO",(no.getText().toString()));

            emp.putExtra("EmpName",(name.getText().toString()));

            emp.putExtra("Sal",(sal.getText().toString()));

            startActivity(emp);
            }
    });

    }

}

インテントからデータを取得する方法??? getExtra() メソッドを使用して ??? または簡単な方法がありますか?? これは私の EmpShow.class ファイルです!!

public class EmpShow extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

     setContentView(R.layout.empshow);
    // TODO Auto-generated method stub

     Intent show = getIntent();     
     }
}
4

2 に答える 2