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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:16:21+00:00 2026-06-17T02:16:21+00:00

somewhere in my app. i need to return ContentValues from a method. But it

  • 0

somewhere in my app. i need to return ContentValues from a method. But it seems i cant do it or there’s something that i miss while implementing it.When i want to pass this returning value to another classes method, it crashes because of nullPointerException.

This is where i call returning ContentValues method and pass it to other:

new Thread(new Runnable() {
            public void run() {
                try{
                    Thread.sleep(3000);
                    generateFeatures gen=new generateFeatures(getBaseContext());
                    ContentValues ourContentValues=gen.letsRollOut(); //calling the method that returns smth. type ContentValues 
                    makeDesicion md=new makeDesicion(ourContentValues,getBaseContext());
                    md.controlWithDB();
                    md.finalDesicion();
                    db.delete("Koordinatlar", null, null);
                    }
                    catch(InterruptedException ex){
                        ex.printStackTrace();
                    }

            }
          }).start();

The method that return ContentValues:

public ContentValues letsRollOut(){
        boolean bitti=false;

        Cursor firstTimeHandler=db.rawQuery("SELECT MIN(zaman) FROM Koordinatlar", null);
        firstTimeHandler.moveToFirst();

        long firstTime= firstTimeHandler.getLong(0);
        long nextTime=firstTime+3000;

        Cursor lastTimeHandler=db.rawQuery("SELECT MAX(zaman) FROM Koordinatlar", null);
        lastTimeHandler.moveToFirst();

        long lastTime=lastTimeHandler.getLong(0);
        while(!bitti){

            myContentValues.clear();

            calculateAverage(firstTime,nextTime);
            calculateStandartDev(firstTime,nextTime);
            calculateAverageAbsoluteDifferance(firstTime,nextTime);
            calculateAverageResultant(firstTime,nextTime);
            calculateMax(firstTime,nextTime);
            calculateBinnedDist(firstTime,nextTime);

            firstTime=(long) (nextTime+0.00000001);
            nextTime=(nextTime+3000);

            if(nextTime>=lastTime){
                bitti=true;

            }

            myContentValues.put("ortX", averageX);
            myContentValues.put("ortY", averageY);
            myContentValues.put("ortZ", averageZ);
            myContentValues.put("stdX", stdX);
            myContentValues.put("stdY", stdY);
            myContentValues.put("stdZ", stdZ);
            myContentValues.put("aadX", aadX);
            myContentValues.put("aadY", aadY);
            myContentValues.put("aadZ", aadZ);
            myContentValues.put("maxX", maxX);
            myContentValues.put("maxY", maxY);
            myContentValues.put("maxZ", maxZ);
            myContentValues.put("averageResultantAcc", averageResultantAcc);



        }


        return myContentValues;

    }

This is where i get error.

public makeDesicion(ContentValues ourContentValues,Context con){
        testContentValues.putAll(ourContentValues);  // get nullpointer error in this line.
        ourContext=con;
        veriTabani=new VeriTabani(this.ourContext);
        db=veriTabani.getWritableDatabase();
    }
  • 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-17T02:16:22+00:00Added an answer on June 17, 2026 at 2:16 am

    It looks like you forgot to initialize testContentValues:

    testContentValues = new ContentValues();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a resource somewhere that says what pieces of an Android app are
Somewhere I did something silly. I was deploying my Rails app via cloning the
This is probably a setting error somewhere. I have a django app that works
I have an iOS app which I need to upload the binary of. From
I remember reading somewhere but I cannot remember where exactly I need to write
Apologies if this is somewhere, but I'm struggling to find the details I need
I do need a good About Dialog for my app, something like the Visual
Pardon me if there's a similar question somewhere on here already, but I couldn't
First, here is where I got the idea from: There was once an app
for my app I need to load some content from my webservice. I want

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.