start of curly bracket.
e.g.
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));
} .....
On Oct 5, 11:28 pm, Isaac Ng <isaac.n...@gmail.com> wrote:
> I have an error on 'else' code on if-else statment. What's wrong, pls
> advise. Thank you.
> //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();
>
> Toast.makeText(getBaseContext(), item,
> Toast.LENGTH_LONG).show();
>
> //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));
> }
>
> //Choose Chapter 4
> else if (item.equalsIgnoreCase("IV. Marketing"));
> {
> //go to chapter 4
> startActivity(new Intent(ChaptersActivity.this,
> Chapter4Activity.class));
> }
>
> //Choose Chapter 5
> else if (item.equalsIgnoreCase("V. Managing Human
> Capital"));
> {
> //go to chapter 5
> startActivity(new Intent(ChaptersActivity.this,
> Chapter5Activity.class));
> }
>
> //Choose Chapter 6
> else if (item.equalsIgnoreCase("VI. Preparing for the
> Examination"));
> {
> //go to chapter 6
> startActivity(new Intent(ChaptersActivity.this,
> Chapter6Activity.class));
> }
> }
> });
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment