布局文件
<EditText android:id="@+id/factorOne" android:layout_width="fill_parent" android:layout_height="wrap_content" />
id 控件的ID ,在ACTIVITY 中可以通过R.id.myid得到控件
textView = (TextView)findViewById(R.id.myResultTextView);
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.result); textView = (TextView)findViewById(R.id.myResultTextView); Intent intent = getIntent(); String a =intent.getStringExtra("f1"); String b =intent.getStringExtra("f2"); Long result = Long.valueOf(a)*Long.valueOf(b); textView.setText(String.valueOf(result)); }
setContentView(R.layout.result); 制定该ACTIVITY要使用的布局文件