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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:45:05+00:00 2026-05-31T12:45:05+00:00

I got a ContentProvider that serves some content e.g. filters. Those will be rendered

  • 0

I got a ContentProvider that serves some content e.g. filters.
Those will be rendered in a ListView. Because the filter has many fields I needed to create an own View for the list items. The fields are mapped in a class that extends CursorAdapter.

public void bindView(View view, Context context, Cursor cursor) {

    TextView searchPattern = (TextView) view.findViewById(R.id.tv_searchpattern);
    TextView searchType = (TextView) view.findViewById(R.id.tv_searchtype);

    int type = cursor.getInt(FilterProvider.SEARCH_TYPE_COLUMN);
    [...]
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    final View view = inflater.inflate(R.layout.group_list_item, parent, false);
    return view;
}

But now I am wondering how I could “carry” the content uris along with the list items.
So that I later can retrieve them later easily to operate (e.g. update, delete) on the item?

Is it a good idea to make use of the View.id field?

    view.setId(cursor.getInt(FilterProvider.KEY_COLUMN));

Or am I completely on the wrong track? Do I need to worry because Integer is actually a Long in Sqlite?

  • 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-31T12:45:06+00:00Added an answer on May 31, 2026 at 12:45 pm

    errr, I wouldn’t mess with the view IDs like that. Just doesn’t seem like a good idea. I can’t say I have any hard evidence that says so, but the cursor adapter is handling the views, who’s to say some future platform version doesn’t do anything important with the children view IDs?

    However, there’s a perfect method for what you want:

    view.setTag(Object someObject);
    

    http://developer.android.com/reference/android/view/View.html#setTag(java.lang.Object)

    So, in your case, you could do :

    view.setTag(new Integer(cursor.getInt(FilterProvider.KEY_COLUMN)));
    

    and then to retrieve it wherever, you would do :

    Integer key = (Integer) view.getTag();
    

    I hope that helps !

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

Sidebar

Related Questions

Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
Got some code here that isn't working: $(#sidebar ul li:last).each(function(){ $(this).addClass(last); }); Basically I
Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got a task to make a program that registers animals and the object is
I've got a CursorLoader in a ListFragment (that is inside a ViewPager ) that
I got this exception 01-03 00:28:43.465 E/AndroidRuntime(13556): java.lang.NoSuchMethodError: android.content.pm.PackageManager.currentToCanonicalPackageNames 01-03 00:28:43.465 E/AndroidRuntime(13556): at com.android.DL_launcher.LauncherProvider$DatabaseHelper.addAppShortcut(LauncherProvider.java:632)
Got something like this <div class=something> <div></div> <p> Some text here </p> </div> This
So I created a simple content provider, but I've got an error : Failed
I got a doubt regarding the content provider. Everytime when i am write the
Got an application wich read some infos in a specific XML file. I would

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.