如何使用常数和基于int的字符串组合?

时间:2014-02-17 13:14:27

标签: android

我的textview -

TextView doses = (TextView) findViewById(R.id.doses);

获取代码 -

int nIndex = cursor.getColumnIndexOrThrow(DictionaryDatabase.KEY_DOSES);

我想要的是在nIndex之前添加一些预定义的TEXT,如“ DOSE:”。 我的预期结果将是 -

doses.setText(cursor.getString("DOSE"+nIndex));

怎么做?

1 个答案:

答案 0 :(得分:2)

请使用:

doses.setText("DOSE" + cursor.getString(nIndex));