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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:02:51+00:00 2026-06-18T08:02:51+00:00

I have just started learning Robotium and I have written a test case which

  • 0

I have just started learning Robotium and I have written a test case which resets recorded statistics in my app. I was wondering if there was a way I could automate the creation of statistics without having to create them myself manually each time I run the test.

Thanks

EDIT:

I’ve now added some random values into the database before running the first test. However this results in a NullPointerException.

This is the method I use to create some stats:

private void createStats() {
    Context context = getInstrumentation().getTargetContext();
    mDbAdapter = new PlayDbAdapter(context);
    mDbAdapter.updateViews(8, 5);
    mDbAdapter.updateViews(7, 3);
    mDbAdapter.updatePrompts(7, 2);
    mDbAdapter.updateCompletions(8, 1);
    mDbAdapter.close();
}

This method is called as I run my first test. The updateViews method is below:

public boolean updateViews(long rowId, int views) {
    ContentValues args = new ContentValues();
    args.put(KEY_VIEWS, views);
    return mDb.update(DB_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
}

The NullPointer is happening at the return statement in the above method. Any ideas why this is?

  • 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-18T08:02:52+00:00Added an answer on June 18, 2026 at 8:02 am

    I cant see all your code but I am guessing you get this error because you are not opening your database properly.

    If it isn’t that I will need to see more code to get an idea of whats happening.

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

Sidebar

Related Questions

I've just started learning to use Robotium for testing my app. I have written
I have just started learning Scala and I'm now wondering how I could implement
I have just started learning Javascript. I want Hello World! to be written to
I have just started learning UML and after completing use case I've just started
I have just started learning python and i was wondering how i would get
i have just started learning objective C. want to create a small app where
I have just started learning python version 3 and trying to create a file
I have just started learning Rails, is it required for me to learn CoffeeScript
I have just started learning Jquery and am new to writing javascript (I am
I have just started learning MVVM and having a dilemna. If I have a

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.