Reputation: 23
I get the following error in my android app:
The type of the expression must be an array type but it resolved to int
protected void onListItemClick(ListView lv, View v, int position, long id) {
super.onListItemClick(lv, v, position, id);
String openClass = R.array.calc_categories[position]; //error on this line
try {
Class selected = Class.forName("com.calculator.commonCalculatios." + openClass);
Intent selectedIntent = new Intent(this, selected);
startActivity(selectedIntent);
Upvotes: 0
Views: 1779
Reputation: 234837
You probably want something like this:
String openClass = getResources().getStringArray(R.array.calc_categories)[position]
Upvotes: 1