I'm getting the error "Syntax error, insert ";" to complete ReturnStatement" in the following code on the line "return int i;"
public class RecordActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record);
int i = intent.getIntExtra(MainActivity.EXTRA_INDEX, 0);
int j = i+1;
final String[]names = getResources().getStringArray(R.array.names);
final TextView nameView = (TextView) findViewById(R.id.vNames);
String vName = names[i];
nameView.setText(vName);
Button nextButton = (Button) findViewById(R.id.nextButton);
nextButton.setOnClickListener(new OnClickListener() {
public static onClickView(View v) {
i=i+1;
return int i;
}
}
);
}
//...
}
I am trying to iterate the index of an array on button click and so am getting the onClick method to return the index 'i' so I can put it into a looping statement. I've checked all brackets close and can't see where I would be missing the ';'. Any help on this would be appreciated.