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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:33:32+00:00 2026-06-08T00:33:32+00:00

In my application I have to pass 5 edit text values from 1 screen

  • 0

In my application I have to pass 5 edit text values from 1 screen to other.I put that in putextra and getextra,But I am getting null pointer exception.I don’t know what I did wrong.Help me.

Here is my code:

Passing screen:

long id=0;
                    db.open();
//                  id=db.insertSpinTitle(group1.getText().toString(), group2.getText().toString(), group3.getText().toString(), group4.getText().toString(), group5.getText().toString());                 
                    Intent spin=new Intent(getApplicationContext(),DBadapter.class);
                    spin.putExtra("grp1val", group1.getText().toString());
                    spin.putExtra("grp2val", group2.getText().toString());
                    spin.putExtra("grp3val", group3.getText().toString());
                    spin.putExtra("grp4val", group4.getText().toString());
                    spin.putExtra("grp5val", group5.getText().toString());
//                  setResult(1,spin); 
                   db.updateSpinTitle();
                    startActivity(spin);

                    finish();  

Getting screen:

public long updateSpinTitle() 
{
    System.out.println("Inside update");
    ContentValues initialValues = new ContentValues();
    for(int i=1;i<=6;i++)
    {
        System.out.println("inside for");       
        Intent intent=getIntent();      
        System.out.println("subbu=");
        if(i==1) initialValues.put(KEY_SPIN, intent.getStringExtra("grp1val")); 
        if(i==2) initialValues.put(KEY_SPIN, intent.getStringExtra("grp2val")); 
        if(i==3) initialValues.put(KEY_SPIN, intent.getStringExtra("grp3val"));
        if(i==4) initialValues.put(KEY_SPIN, intent.getStringExtra("grp4val")); 
        if(i==5) initialValues.put(KEY_SPIN, intent.getStringExtra("grp5val")); 
        if(i==6) initialValues.put(KEY_SPIN, "Edit"); 

        db.update(DATABASE_TABLESPIN, initialValues, KEY_ROWID + "=" + i, null);
        }
    return 0 ;
            } 

This is my logcat:

07-18 09:55:02.324: D/AndroidRuntime(435): Shutting down VM
07-18 09:55:02.324: W/dalvikvm(435): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
07-18 09:55:02.324: E/AndroidRuntime(435): Uncaught handler: thread main exiting due to uncaught exception
07-18 09:55:02.344: E/AndroidRuntime(435): java.lang.NullPointerException
07-18 09:55:02.344: E/AndroidRuntime(435):  at com.budget1.DBadapter.updateSpinTitle(DBadapter.java:128)
07-18 09:55:02.344: E/AndroidRuntime(435):  at com.budget1.SpinnerEdit$1.onClick(SpinnerEdit.java:58)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.View.performClick(View.java:2364)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.View.onTouchEvent(View.java:4179)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.widget.TextView.onTouchEvent(TextView.java:6541)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.View.dispatchTouchEvent(View.java:3709)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
07-18 09:55:02.344: E/AndroidRuntime(435):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
07-18 09:55:02.344: E/AndroidRuntime(435):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
07-18 09:55:02.344: E/AndroidRuntime(435):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.os.Looper.loop(Looper.java:123)
07-18 09:55:02.344: E/AndroidRuntime(435):  at android.app.ActivityThread.main(ActivityThread.java:4363)
07-18 09:55:02.344: E/AndroidRuntime(435):  at java.lang.reflect.Method.invokeNative(Native Method)
07-18 09:55:02.344: E/AndroidRuntime(435):  at java.lang.reflect.Method.invoke(Method.java:521)
07-18 09:55:02.344: E/AndroidRuntime(435):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-18 09:55:02.344: E/AndroidRuntime(435):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-18 09:55:02.344: E/AndroidRuntime(435):  at dalvik.system.NativeStart.main(Native Method)
07-18 09:55:02.366: I/dalvikvm(435): threadid=7: reacting to signal 3
07-18 09:55:02.366: E/dalvikvm(435): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
  • 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-08T00:33:34+00:00Added an answer on June 8, 2026 at 12:33 am

    I think you need to read Intents throughly, before using this, we need to use intents to activate some component in an android application, components include, Activity, Service, BroadcastReceiver. We put some extra values to intent, so target component can pick the data. To save and fetch data from any activity dont require intents to use, we can simply call any method of database helper class, for example you can write this method as:

     db.open();
     db.updateSpinTitle(group1.getText().toString(), group2.getText().toString(),
                             group3.getText().toString(),  group4.getText().toString(),
                             group5.getText().toString());
    

    and change method updateSpinTitle to following:

    public long updateSpinTitle(String grp1, String grp2, String grp3, String grp4, String grp5) 
    {
        System.out.println("Inside update");
        ContentValues initialValues = new ContentValues();
        for(int i=1;i<=6;i++)
        {
            System.out.println("inside for");       
            if(i==1) initialValues.put(KEY_SPIN, grp1); 
            if(i==2) initialValues.put(KEY_SPIN, grp2); 
            if(i==3) initialValues.put(KEY_SPIN, grp3);
            if(i==4) initialValues.put(KEY_SPIN, grp4); 
            if(i==5) initialValues.put(KEY_SPIN, grp5); 
            if(i==6) initialValues.put(KEY_SPIN, "Edit"); 
    
            db.update(DATABASE_TABLESPIN, initialValues, KEY_ROWID + "=" + i, null);
            }
        return 0 ;
                } 
    

    And if its DBAdapter is an activity then you should invoke updateSpinTitle in one of lifecycle method of the activity, like onCreate.

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

Sidebar

Related Questions

I have to pass information from a desktop application to Web application and vice
I have an application where I'm trying to pass a UIScrollView from one UIViewController
I have an application in which I need to pass an array from C#
Anyone have idea how to pass value from iPhone application to the REST-Webservice using
I have a requirement to pass credentials from one Microsoft .NET Web Application to
I have a Windows application that HAS to run as 32-bits (because of other
We have an old application that reads in SQL text files and sends them
i have two flex applications and i want to pass the data from one
In My application have time consuming process.There fore i try to do that operation
i am new to android. in my application i have a button .i put

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.