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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:26:35+00:00 2026-06-05T23:26:35+00:00

Im relatively new to the Android world but I have a quick question. I

  • 0

Im relatively new to the Android world but I have a quick question.

I have a list on one page that has a potentially unlimited amount of rows which will be populated by a database. These will go to different activities based on their type (like Customers etc.) Is it possible to send the user to a specific activity based on which one they tap?

I have seen some solutions that are based on a switch/case, but this seems to be used if you have a list of finite items, and you know the names of those items beforehand.

So, what I am saying is if I use a switch/case solution, how does the application know which buttons goes to which case? Does this need to be defined in the list itself or something in the database?

I can’t provide any code at the moment because it’s not that far into development and I am also under NDA about the project!

  • 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-06-05T23:26:37+00:00Added an answer on June 5, 2026 at 11:26 pm

    You can do that in the setonitemclicklistener(). This function is called whenever you click on any of the rows of the list view. The position/row number of the item that you have clicked is also passed on to this function.

    Since you are using Database to Populate your List, you can do this :

         setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES));
    
              ListView lv = getListView();
              lv.setTextFilterEnabled(true);
    
                //SEE THIS FUNCTION
    
                lv.setOnItemClickListener(new OnItemClickListener() {
                    public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {
                      /*
                        "position" is the position/row of the item that you have clicked
    
                        Query your table. Then move the cursor to "position" and get the 
                        details. THen based on the details call a new activity.
    
                        */
                        Cursor cur=db.query("your table name",null,null,null,null,null.null);
                        cur.moveToPosition(position); // see the argument int position
    
                    //Extract details from this row,process it and send to the respective activiy                       
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm relatively new to Android but I just cant google this. I have following
I am relatively new to Android Animation and Gestures. I have 15 images that
I am relatively new to Android development but I do have a pretty good
I am a relatively new Android developer but have gotten pretty familiar with the
I am relatively new to Android development. My requirement is such that I have
I am relatively new to Android, but I am looking to use an interactive
Hi I'm relatively new to Android programming but I would be grateful of some
I am relatively new to android. I have two applications A and B. I
I am relatively new to using SQLite on Android. I have some experience with
I`m relatively new at Android development, although I have created a few basic applications.

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.