Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1094453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:58:28+00:00 2026-05-16T23:58:28+00:00

I have created four tabs with listview in each. I have been attempting to

  • 0

I have created four tabs with listview in each. I have been attempting to make the list views clickable, I have used the listview tutorial from Here to create the list view using string.xml and R.array:

The problem is when I use my intent and onItemClickListener I get multiple marker errors, if I play around with the commas brackets and class body markers the errors move around, so is it the syntax that’s the problem or is it the lay out or postion of the code;

public class ll2 extends ListActivity {

    static final String[] teams = new String[] {"Accrington Stanley", "Aldershot", "Barnet", "Bradford City", "Burton Albion", "Bury", "Cheltenham Town", "Chesterfield", "Crewe Alexandra"};


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final String[] TEAMS = getResources().getStringArray(R.array.twoteams_array);
        setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, TEAMS));

        ListView lv = getListView();
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {

            public void onListItemClick(ListView, parent, View v, int position, long id);
            }

            if (position == "Braford City") {
                Intent intent = new Intent(this, Bradford.class);
                startActivity(intent);
            }

}

I get these errors here:

static final String[] teams = new String[] {"Accrington Stanley", "Aldershot", "Barnet", "Bradford City", "Burton Albion", "Bury", "Cheltenham Town", "Chesterfield", "Crewe Alexandra"};

Syntax error, insert “}” to complete
ClassBody

If I add to complete class body I get more erros here and in other places.

I get these errors here:

  public void onListItemClick(ListView, parent, View v, int position, long id); }
Multiple markers at this line
    - Syntax error on token(s), misplaced construct(s)  
    - Syntax error, insert ";" to complete LocalVariableDeclarationStatement  
    - Syntax error on token ",", ; expected
    - Syntax error on token "(", = expected
    - Syntax error on token ",", ; expected
    - Syntax error, insert "}" to complete MethodBody
    - Syntax error, insert "}" to complete ClassBody
    - Syntax error on token "}", delete this token

Same problem here I have tried different combinations and it gives me errors constantly with this setup I have the least amount of errors

Any help greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:58:29+00:00Added an answer on May 16, 2026 at 11:58 pm

    Everything is fine until setOnItemClickListener, where it becomes a mess.

     1  lv.setOnItemClickListener(new OnItemClickListener() {
     2      public void onItemClick(AdapterView<?> parent, View view, 
                                    int position, long id) {
     3
     4      public void onListItemClick(ListView, parent, View v,
                                        int position, long id);
     5      }
     6
     7      if (position == "Braford City") {
     8          Intent intent = new Intent(this, Bradford.class);
     9          startActivity(intent);
    10      }
    11
    12
    
    • Line 2: You don’t close the onItemClick method definition, so add a brace }.
    • Line 4: Should not end with a semicolon ; but a open brace {
    • Line 7: You cannot compare an int (position) with a String
    • Lines 7-10: These must be inside a method definition, e.g. move them to before line 5
    • Line 11: You need to close the new OnItemClickListener() you opened on line 1 and the setOnItemClickListener call, by adding: });
    • Line 12: You need to close the class ll2 with a brace }.

    Furthermore, ListActivity already comes with an onListItemClick method, so you don’t need the above code in onCreate — no need to define your own listener.

    Just add a new method in your class, after onCreate:

    public void onListItemClick(ListView l, View v, int position, long id) {
        if (position == 3) {
            Intent intent = new Intent(this, Bradford.class);
            startActivity(intent);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created four tabs using tabhost, and placed four listviews in each like
I have created a tabbed view with four tabs and attached four listviews to
I have created TabActivity class in which i am creating four tabs for my
I've created a tab bar application. I have four tabs; on the selected tab,
I have created a plot made up of four subplots; each subplot is a
Hi I have created a List of Objects. Each object contains a Set. I
I have created a UserControl that has a ListView in it. The ListView is
I have created a few small flash widgets that stream .mp3 audio from an
I have created a custom shape, essentially it is a collection of four Arc2D
Hello I have created a filter for my list. In a template named _search.gsp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.