我有错误“我的字符串无法解析为变量”,我如何在同一活动中访问字符串。
String mystring = null;
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mystring = ((TextView) view.findViewById(R.id.date)).getText().toString();
Toast.makeText(this, mystring, Toast.LENGTH_SHORT).show();
}
public void setAdapterToListview() {
objAdapter.notifyDataSetChanged();
isloading = false;
listView.removeFooterView(footer);
int TOTAL_ITMES = 0;
try {
TOTAL_ITMES = Integer.parseInt(mystring);
} catch(NumberFormatException nfe) {
}
if (mainArrayList != null && mainArrayList.size() >= TOTAL_ITMES) {
System.out.println("Total Size ::"+mainArrayList.size());
hasMore = false;
}
}
Toast 工作正常......但是字符串名称“mystring”在这一行中不可能
TOTAL_ITMES = Integer.parseInt(mystring);
我怎样才能?