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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:05:18+00:00 2026-05-31T02:05:18+00:00

I fetch record from database using following code. for (LocWiseProfileBeans cn : LocWiseProfile) {

  • 0

I fetch record from database using following code.

 for (LocWiseProfileBeans cn : LocWiseProfile) {
        // get a reference for the TableLayout
        TableLayout table = (TableLayout) findViewById(R.id.locprofile_table);

        // create a new TableRow
        TableRow row = new TableRow(this);

        // count the counter up by one
        counter++;


        String log = "Loc Name: "+cn.getLocname()+" ,Lattitude: " + cn.getLattitude()+ " ,Longitude: " + cn.getLongitude()+ " , Selected Profile :"+cn.getSelectedprofile();
        TextView t = new TextView(this);
        // set the text to "text xx"
        t.setText(cn.getLocname());

        TextView t2 = new TextView(this);
        t2.setText(cn.getSelectedprofile());
        row.addView(t);
        row.addView(t2);
        table.addView(row,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

But i need to enable this record for deletion on user request.
Means if user click on second record then this record will be delete.
I try to find the answer but not find any appropriate answer…….
Please provide me reference code or article.
Thank you in Advance!

  • 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-31T02:05:19+00:00Added an answer on May 31, 2026 at 2:05 am

    You can do this by setting onClickListener to your row.
    To determine which row is clicked, you can set a unique tag to that row.

    row.setTag(counter);  //  use counter or index for tag, so you can get the data from LocWiseProfile later
    row.setOnClickListener(new OnClickListener()  {
        @Override
        public void onClick(View v)  {
            int tag = (Integer)view.getTag();
            LocWiseProfileBeans cn = LocWiseProfile.get(tag);
            //  Perform delete action here
            //  ...
        }   
    });
    

    If you want to simply display the result from db as a list, I suggest you using ListActivity or ListView, with using adapter you can show and manage your data in more simple way.

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

Sidebar

Related Questions

I am using Zend Framework. I want to fetch record from database without considering
I'm using SimpleJdbcTemplate to fetch a list of records from a database. Each record
We need to fetch data from a database using LINQ. We now need to
I am trying to display all records from my table CarCollection using the following
I'm using a loop to fetch records from a database. I want it so
I am trying to fetch some records from table but when i use OR
I want to fetch the unmatching records from two table in SQL, the table
I want fetch last record using hibernate criteria Can u help me?
What I try to ask is how to select from database record and my
I'm new to PHP. I'm using the following code to generate an excel sheet

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.