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 6362279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:53:17+00:00 2026-05-24T23:53:17+00:00

I have tried many things to make this code work, it consists of showing

  • 0

I have tried many things to make this code work, it consists of showing an AlertDialog/description when taping on an element/marker from map. The problem is that 3 of 4 markers work (but not showing the right description. it looks like the previous one) and the last force closes the app with the logcat error:

CursorIndexOutOfBoundsException: Index 4 requested, with a size of 4

Code:

@Override
        protected boolean onTap(int index) {
            db = openHelper.getWritableDatabase();

            String[] columns_descri = new String[] {COL_DESCRI};

            Cursor cur = db.query(true, TABLE_COORD, columns_descri,null, null, null, null, null, null);

            cur.moveToPosition(index);
                String description = cur.getString(cur.getColumnIndexOrThrow(COL_DESCRI));

                AlertDialog.Builder dialog = new AlertDialog.Builder(Geo.this);
                dialog.setTitle("Infos.");
                dialog.setMessage(description);
                dialog.setPositiveButton("OK", new OnClickListener() {    
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
                dialog.show();

             cur.close();
             db.close();

            return true;
        }
  • 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-24T23:53:18+00:00Added an answer on May 24, 2026 at 11:53 pm

    you should not use directly index, instead, you probably have an adapter somewhere that can give you either the object you want to display or the _id of your row, which you can use to forge a precise request

    edit

    You are using a ItemizedOverlay. Therefore, you can get the tapped item by :

    public void onTap(int index) {
        Item item = getItem(index);
    }
    

    Then I suppose you can get the relevant informations from the item rather than from a cursor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried so many things to make this work and I have failed
I have tried so many things, cannot figure this out, I am using this
I have tried what seems like everything - I've done similiar things many times
This should be really simple, but I have tried many solutions posted on the
I have asked this question so many times and have tried so many different
Over the years, I have tried many times to find a good, easy to
I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item(Post), \b\#\b) But it is
I have this many hundreds of cell long Mathematica file and I want to
I have run into this issue too many times and need this to be
I have tried many PHP MVC frameworks and I noticed that in many frameworks

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.