我的继承人一流从一个屏幕将值传递给另一个Android的
public void onClick(View view) {
Intent i = new Intent(First.this,second.class);
startActivity(i);
cat=(EditText) findViewById(R.id.textView_cat);
String s = getIntent().getStringExtra("myString");
cat.setText(s);
我的继承人二等
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@SuppressWarnings("unchecked")
HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);
String selectedFromList = o.get("name");//(String) (lv.getItemAtPosition(position));
Intent i = new Intent(second.this, First.class);
i.putExtra("myString", selectedFromList);
startActivity(i);
}
我想点击的按钮后,进入到第二类(第二屏)首先(在第一个屏幕上)。然后我想要访问第一个(屏幕)中第二类(屏幕)中选择的listitem的值。但有这个问题。帮助将不胜感激..!
我能够将first.class的值传递给second.class,但我想在second.class中获取值,并在first.class中访问它。 Theres问题...... !!!
Thanx。
你能给引发的错误?据我所知,你似乎做了正确的事情:获取点击的项目,获取你交叉的数据,putExtra,并开始活动。 也许你的班级命名有问题。 logcat在说什么? – 2011-12-27 21:13:50
您想在哪里访问该值? – coder 2011-12-27 21:14:17
考虑在你的案例中使用[Activity.startActivityForResult()](http://developer.android.com/reference/android/app/Activity.html)。 – yorkw 2011-12-27 21:25:46