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

  • Home
  • SEARCH
  • 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 6005401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:23:30+00:00 2026-05-23T01:23:30+00:00

Yesterday I posted a similar question on why my code started on my content

  • 0

Yesterday I posted a similar question on why my code started on my content provider class rather than the main class and I’ve gotten some feedback which I’ve updated but the problem still remains where the code starts with the ContentProvider class rather than the main class. I’ve run through the code with debugger and its puzzling why the code starts in the Content Provider and passes back to the main class at the Context stage. I hope to solicit some help here !

The main class is here:

public class MedF1 extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.drug_list); 

    ListView drugListView;
    ArrayAdapter<Drug> aa;
    ArrayList<Drug> drugs = new ArrayList<Drug>();

    drugListView = (ListView)this.findViewById(R.id.list1);
    DrugProvider.DatabaseHelper mDbHelper1 = new DrugProvider.DatabaseHelper(this);

    //Creation of the Database here
    try {

    mDbHelper1.createDataBase();

    } catch (IOException ioe) {

    throw new Error("Unable to create database");

    }

    try {

    mDbHelper1.openDataBase();

    }catch(SQLException sqle){

    throw sqle;

    }

The Content Provider class is as follows.

public class DrugProvider extends ContentProvider {

// publishing the URI for this provider
public static final Uri CONTENT_URI = Uri
        .parse("content://com.paad.provider.drug/drugs");

private static final int DRUGS = 1;
private static final int DRUG_ID = 2;
private static final UriMatcher uriMatcher;

// allocating UriMatcher object

static {
    uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
    uriMatcher.addURI("com.paad.provider.drug", "drugs", DRUGS);
    uriMatcher.addURI("com.paad.provider.drug", "drugs/#", DRUG_ID);
}

// Column names
public static final String KEY_ROWID = "_id";
public static final String KEY_DRUG = "drug";
public static final String KEY_CONTENT = "content";
public static final String KEY_INDICATION = "indication";
public static final String KEY_DOSAGE = "dosage";
public static final String KEY_SPECIALPRECAUTION = "specialprecaution";

// Column indexes
public static final int DRUG_COLUMN = 1;
public static final int CONTENT_COLUMN = 2;
public static final int INDICATION_COLUMN = 3;
public static final int DOSAGE_COLUMN = 4;
public static final int SPECIALPRECAUTION_COLUMN = 5;

// private DatabaseHelper mDbHelper;
// private SQLiteDatabase mDb;
private static String DB_PATH = "data/data/com.paad.MedF1/databases/";
private static String DB_NAME = "data";
private static final int DATABASE_VERSION = 1;
private static final String DRUG_TABLE = "drugs";

public static SQLiteDatabase myDataBase;



// Creation of the database and its basic parameters
public static class DatabaseHelper extends SQLiteOpenHelper {   

    public final Context myContext;

    public DatabaseHelper(Context context) {

        super(context, DB_NAME, null, 1);

        this.myContext = context;

    }
  • 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-23T01:23:31+00:00Added an answer on May 23, 2026 at 1:23 am

    Hey I’ve found out why the code started at the ContentProvider rather than the main class. It was because of the implemented method (onCreate) that comes with the extension of the ContentProvider . I repurposed another tutorial to create it without really understanding it … thats why. yup anyone else facing the problem should try exploring if the onCreate method in the Content provider class is affecting it – its not the manifest problem 🙂

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

Sidebar

Related Questions

In another question I posted yesterday, I got very good advice on how a
I posted this question yesterday evening, which has led me to discover a huge
Yesterday, I posted an answer to a question that included several (unknown to me
Following on from a question I posted yesterday about GUIs, I have another problem
Yesterday I posted this question regarding using lambdas inside of a Join() method to
this is a rephrasing of a question I posted yesterday. I got an answer
This is a followup to a question I posted yesterday. I thought everything was
this is a follow-up to the question I posted yesterday. I was able to
this is following on from this question I posted yesterday - my question from
Yesterday I discovered an odd bug in rather simple code that basically gets text

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.