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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:34:29+00:00 2026-06-15T11:34:29+00:00

I have a database that allows the user to query for books in the

  • 0

I have a database that allows the user to query for books in the database.

I am trying to save the query result as a “bookmark.” The user enters a query and is then able to click on a result to see detailed information for that particular book.

Then there is a menu option to allow the user to “save” the query to their bookmarks. The saved query is inserted into a database table. Bookmarks is a activity that loads the saved data as a list view allowing the user to manage their bookmarks.

Everything is set up and working wonderfully except for the saving. I do not know how, or what would be the best way to get the results from the query into the database when the saved menu option is picked.

A standard sqlite insert works, but does not have the specific query result data with it.

Some of the code:

package com.example.newdatabase;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Toast;


public class DetailView extends Activity
{
    private DBAdapter dbHelper;
    private SimpleCursorAdapter dataAdapter;
    private long rowid;//row for book from position in database
    public static final String BOOKM_ID = "rowid";

@Override
   public void onCreate(Bundle savedInstanceState) 
   {
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.detailviewlist);

  rowid=getIntent().getExtras().getLong(TitleSearch.ROW_ID);//passed from TitleSearch pass the row id

        dbHelper = new DBAdapter(this);
        dbHelper.open();

        //loads data into list 
        displayListView();
   }

private void displayListView()
{
    Cursor cursor=dbHelper.getABOOK(rowid);//cursor and query method only shows one book

    //defines columns to bind
    String [] columns =new String[]
            {
                DBAdapter.KEY_TITLE,
                DBAdapter.KEY_AUTHOR,
                DBAdapter.KEY_EDITION,
                DBAdapter.KEY_PUBLISHER,
                DBAdapter.KEY_DESCRIPTION,
                DBAdapter.KEY_OPAC,
                DBAdapter.KEY_LOCATION,
                DBAdapter.KEY_CALL,
                DBAdapter.KEY_COPIES,
                DBAdapter.KEY_STATUS,

            };

    // the XML defined views which the data will be bound to
      int[] to = new int[] 
      {
        R.id.title,
        R.id.author,
        R.id.edition,
        R.id.publisher,
        R.id.description,
        R.id.subject,
        R.id.location,
        R.id.callnum,
        R.id.copies,
        R.id.status,
      };

    // create the adapter using the cursor pointing to the desired data
      //as well as the layout information
      dataAdapter = new SimpleCursorAdapter(
        this, R.layout.detailbook,
       cursor,
       columns,
        to,
        0);

     ListView listView = (ListView) findViewById(R.id.listView2);
      // Assign adapter to ListView
      listView.setAdapter(dataAdapter);

}
   @Override
    public boolean onCreateOptionsMenu(Menu menu) //save menu
    {
       super.onCreateOptionsMenu(menu);
       MenuInflater inflater = getMenuInflater();
       inflater.inflate(R.menu.savemenu, menu);
       return true;

    }



  /* @Override
    public boolean onOptionsItemSelected(MenuItem item) //lauches the bookmark when saved
    {
       Intent addContact = new Intent(DetailView.this, Bookmark.class);
       startActivity(addContact);
       return super.onOptionsItemSelected(item);
    }*/


   public boolean onOptionsItemSelected(MenuItem item)//menu action
    {

        switch (item.getItemId())
        {
        case R.id.addsave:
            // Single menu item is selected to save book info

            //adds info into bookmark on save click

            //this is where i am having an issue





            Toast.makeText(DetailView.this, "The book has been saved!", Toast.LENGTH_SHORT).show();//feedback for user
            return true;

        default:
            return super.onOptionsItemSelected(item);

        }

    } //end of options
    }//end of detail view

I am trying the save the results from getABOOK(rowid) query into the database table that Bookmarks uses.

Unless there is a better way to save the results.

  • 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-15T11:34:30+00:00Added an answer on June 15, 2026 at 11:34 am

    I would recommend having a new column called Bookmark in the same table and add the timestamp of bookmark to a particular row(s) when the user selects bookmark.

    Now in the bookmark view you can simply query for all rows where bookmark is not null.

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

Sidebar

Related Questions

I have a form that allows me to enter a user into my database.
I have written an application that allows a user to define a query, run
I have two .php files which show all contacts in a database, then allows
I am trying create a small web application that allows a user to login
I'm exposing a more or less public API that allows the user to query
We have a form that allows a user to filter a list with by
We have an application that allows the user to add custom columns to our
I have a web application that allows a user to upload an Excel spreadsheet
We have a grid control that allows a user to filter text in different
I have a hosted database I work with that allows me to drop in

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.