所以我有这个Activity B和textview。要显示到 textview 中的字符串来自我之前的 Activity A(包含多个记录/Passed thru Bundle 的结果查询)
我的问题是如何让每条记录都可以点击?请注意,在我的 Activity B 中,我只有一个 textview 用于Activity A中的字符串。我希望每个单词都是可点击的,然后它将进入相应的活动。
仅供参考, 这是选定的
更新:
结果类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.symptomsresult);
result = (TextView) findViewById (R.id.tvSymptomResult);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String value = extras.getString("results");
result.setText(value);
}
else{
}
}
症状类
String[] symptoms = alSymptoms.toArray(new String[alSymptoms.size()]);
String c = dbHelper.getData(symptoms);
final int result = 1;
Bundle extras = new Bundle();
Intent i = new Intent(this, SymptomsResult.class);
extras.putString("results", c);
i.putExtras(extras);
startActivityForResult(i, result);
DBHelper.class
public String getData(String[] symptoms) {
String where = KEY_SYMPTOMS + "= ?";
String orStr = " OR "; /* Maybe " AND "? */
StringBuilder builder = new StringBuilder(where);
for(int i = 1; i < symptoms.length; i++)
builder.append(orStr).append(where);
String search = "";
Cursor c = myDataBase.query(true, DB_TABLE, new String[]
{KEY_CONDITIONS}, builder.toString(), symptoms, null, null, null, null);
c.moveToFirst();
while (c.isAfterLast() == false) {
search += c.getString(0) + ", ";
c.moveToNext();
}
return search;
}
任何帮助表示赞赏。谢谢!