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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:53:45+00:00 2026-06-15T19:53:45+00:00

I have a series of ListFragments each displaying a different SQLite table or view.

  • 0

I have a series of ListFragments each displaying a different SQLite table or view. I switch between them with swipable tab layouts.

I have two different swipable layouts that load into the same activity, depending on the Intent arguments which are called. Buttons on an alertdialog and on the actionbar switch the swipable layouts. The Swipable Tab setup is described http://www.pushing-pixels.org/2011/08/11/android-tips-and-tricks-swipey-tabs.html .

The problem occurs after the item click.

android.database.sqlite.SQLiteException: no such column: authorHash: , 
  while compiling: SELECT name, shared, authorHash, primaryMatch 
  FROM contacts_view

The Exception shows that the SELECT clause is from the first declaration below, while the VIEW is from the second.

LogFragment.newInstance(PeerDataProvider.URI_RESPONSES_VIEW,
  PeerDataProvider.URI_PEERDATA_TABLE, R.loader.responseslogfragloader,
  PeerCreatedDataColumns.NAME, 
      new String[] { PeerCreatedDataColumns.NAME,
  PeerCreatedDataColumns.SHARED, PeerCreatedDataColumns.AUTHORHASH,
  ResponsesColumns.PRIMARYMATCH });

LogFragment.newInstance(UserDataProvider.URI_CONTACTS_VIEW, 
      UserDataProvider.URI_USERDATA_TABLE, R.loader.contactslogfragloader, 
      UserCreatedDataColumns.NAME,
  new String[] { UserCreatedDataColumns.LONGSUMMARY }); 

Here is the fragment being called:

public class LogFragment extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> {
private static int LIST_LOADER;
protected int layout = R.layout.log_fragment;
int entryLayout = R.layout.list_item;
private static Uri logView, logTable;
String[] listItemProjection;
int[] listItemFields = { R.id.title };
String itemClickProjection[];
String[] createProjection;
int mCurCheckPosition = 0;
Button clearLogButton;
protected SimpleCursorAdapter listAdapter;

public static Fragment newInstance(Uri logview, Uri logtable, int listLoader, String displayColumn,
        String[] clickProjection) {
    LogFragment f = new LogFragment();
    Bundle args = new Bundle();
    args.putString("listItemProjection", "" + displayColumn);
    args.putStringArray("itemClickProjection", clickProjection);
    args.putString("logView", "" + logview);
    args.putString("logTable", "" + logtable);
    args.putString("LIST_LOADER", "" + listLoader);
    Log.d(DEBUG_TAG, "listLoader" + listLoader);
    f.setArguments(args);
    return f;
}

public LogFragment() {
    super();
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(layout, container, false);

    String listItemProjection_String = getArguments().getString("listItemProjection");
    String[] itemClickProjection_StringArray = getArguments().getStringArray("itemClickProjection");
    String logView_String = getArguments().getString("logView");
    String logTable_String = getArguments().getString("logTable");
    String LIST_LOADER_String = getArguments().getString("LIST_LOADER");
    listItemProjection = new String[] { listItemProjection_String };
    createProjection = new String[] { UserDatabase._ID, listItemProjection_String };
    itemClickProjection = itemClickProjection_StringArray;
    logView = Uri.parse(logView_String);
    logTable = Uri.parse(logTable_String);
    LIST_LOADER = Integer.parseInt(LIST_LOADER_String);

    getLoaderManager().initLoader(LIST_LOADER, null, this);
    listAdapter = new SimpleCursorAdapter(getActivity().getApplicationContext(), entryLayout, null,
            listItemProjection, listItemFields, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
    setListAdapter(listAdapter);
    return view;
}

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    Cursor c = getActivity().getContentResolver().query(logView, itemClickProjection, null, null, null);
    String fields = "";
    c.moveToPosition(position);
    for (String column : itemClickProjection) {
        fields += column + " " + c.getString(c.getColumnIndex(column)) + "\n";
        Toast.makeText(getActivity(), fields, Toast.LENGTH_SHORT).show();
    }
}
}

And here is the adapter

private class SearchSwipePagerAdapter extends FragmentPagerAdapter implements SwipeyTabsAdapter {
    private final String DEBUG_TAG = "SearchSwipePagerAdapter";
    private final Context mContext;
    public SearchSwipePagerAdapter(Context context, FragmentManager fm) {
        super(fm);
        this.mContext = context;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
        case 0:
            return SearchFragment.newInstance();
        case 1:
            return ResponsesFragment.newInstance();
        case 2:
            return LogFragment.newInstance(PeerDataProvider.URI_RESPONSES_VIEW,
                    PeerDataProvider.URI_PEERDATA_TABLE, R.loader.responseslogfragloader,
                    PeerCreatedDataColumns.NAME, new String[] { PeerCreatedDataColumns.NAME,
                            PeerCreatedDataColumns.SHARED, PeerCreatedDataColumns.AUTHORHASH,
                            ResponsesColumns.PRIMARYMATCH });
        case 3:
            return LogFragment.newInstance(UserDataProvider.URI_CONTACTS_VIEW, UserDataProvider.URI_USERDATA_TABLE,
                    R.loader.contactslogfragloader, UserCreatedDataColumns.NAME,
                    new String[] { UserCreatedDataColumns.LONGSUMMARY });
        case 4:
            return LogFragment.newInstance(PeerDataProvider.URI_METHODS_VIEW, PeerDataProvider.URI_PEERDATA_TABLE,
                    R.loader.methodslogfragloader, PeerCreatedDataColumns.NAME, new String[] {
                            PeerCreatedDataColumns.NAME, PeerCreatedDataColumns.SHARED,
                            PeerCreatedDataColumns.AUTHORHASH, MethodsColumns.PRIMARYMATCH });
        default:
            return SwipeyTabFragment.newInstance(WORKFLOW[position]);
        }
    }

Each fragment has a unique loader id. I am maintaining compatibility mode throughout 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-15T19:53:46+00:00Added an answer on June 15, 2026 at 7:53 pm

    This declaration:

    private static Uri logView, logTable;
    

    means your LogFragment will always have as those Uris the Uris that you pass to the last fragment built by the FragmentPagerAdapter as those static variables will be shared by your LogFragment instances. Make those fields as instance variables:

    private Uri logView, logTable;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have series of records in a table called 'hits' and each record has
I have series of different occurrences of table cells in some html files as
I have a series of strings (URLs) in different forms as: http://domain name.anything/anypath https://dmain
I have a series of array formulas in Excel that key off of each
I have series of functions with different argument signatures: public void function1 (string s1,
I have a series of UIViewControllers throughout my application. Most of them have the
I have a series of objects I have created: Item Order Song etc. Each
I have a form with series of 3 file upload fields, each of which
I have series of Toast messages in a module which displays a Toast each
I have a series of posts in a custom post type. They each have

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.