• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Compilation error on my if else statement

isaacng88

Lurker
Hi,
I've an error sntax on my 'else' in this if-else statement. anyone know why? Pls advise. thank you.

source code:

//click on one of chapters
list.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{

String item = ((TextView)view).getText().toString();
//Choose Chapter 1

if (item.equalsIgnoreCase("I. The Global Business Environment"));
{
//go to chapter 1
startActivity(new Intent(ChaptersActivity.this, Chapter1Activity.class));
}
else if (item.equalsIgnoreCase("II. Information Systems"));
{
//go to chapter 2
startActivity(new Intent(ChaptersActivity.this, Chapter2Activity.class));
}
//Choose Chapter 3
else if (item.equalsIgnoreCase("III. Operations Management"));
{
//go to chapter 3
startActivity(new Intent(ChaptersActivity.this, Chapter3Activity.class));
}
 
Syntax error is that it is semi-colon after the if and else if statements. Remove them and it will be okay.
 
Back
Top Bottom