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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:33:42+00:00 2026-06-12T12:33:42+00:00

I am getting the exception of Unable to start activity ComponentInfo:java.nullpointer exception i have

  • 0

I am getting the exception of Unable to start activity ComponentInfo:java.nullpointer exception i have checked my entire code everywhere but i am not able to resolve the error

This is my code

    public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.store_denomination);
    actionbar=getSupportActionBar();
    actionbar.setDisplayShowHomeEnabled(false);
     actionbar.setDisplayShowTitleEnabled(false);
     actionbar.setDisplayShowCustomEnabled(true);
     actionbar1 = LayoutInflater.from(this).inflate(R.layout.action_custom, null);

    spin1 = (Spinner)findViewById(R.id.spin);   
    ProgressDialog progress = new ProgressDialog(this);
    progress.setMessage("Loading......");
    new MyClass(progress).execute();

    String urlvalue = ((MyApplication) getApplicationContext()).url;
    new DownloadImageTask().execute(urlvalue);




    youpaytxt = (TextView)findViewById(R.id.youpaytextview);  
    //name = (TextView)findViewById(R.id.nametextview);
    description = (TextView)findViewById(R.id.descriptiontextview);
    btncheckout = (Button)findViewById(R.id.checkoutbutton);
    edt = (EditText)findViewById(R.id.editText1);
    thumb_image = (ImageView)findViewById(R.id.imageView1);
    contshopping = (Button)findViewById(R.id.continueshoppingbutton);
    pg = (ProgressBar)findViewById(R.id.progressBar1);
    nametextview = (TextView)findViewById(R.id.nametextview);
    description = (TextView)findViewById(R.id.descriptiontextview);
    btnterms = (Button)findViewById(R.id.termsbutton);
    //termstxt=(TextView)findViewById(R.id.trmstxtview);
    //termstxt.setVisibility(termstxt.GONE);
    //termstxt.setTypeface(arial_font);

    description.setTypeface(arial_font);
    name = ((MyApplication) getApplicationContext()).nameofbrand;
    nametextview.setText(name);
    Typeface.createFromAsset(getAssets(), "fonts/arial.ttf");
    quant = String.valueOf(1);
    btn=(ImageButton)findViewById(R.id.cartbutton);
    if(!(((MyApplication)getApplicationContext()).cartproductsname).isEmpty())
    {
    btn.setOnClickListener(new OnClickListener() {          //error is coming here from logcat

        public void onClick(View v) {
            // TODO Auto-generated method stub
        Intent first=new     Intent(Detailsofproduct.this,CommentListActivity.class);   
        startActivity(first);
        }
    });
    }

This is my logcat

10-09 13:01:01.951: E/AndroidRuntime(2135): FATAL EXCEPTION: main
10-09 13:01:01.951: E/AndroidRuntime(2135): java.lang.RuntimeException: Unable to start   activity ComponentInfo{com.androidhive.xmlparsing/com.androidhive.xmlparsing.Detailsofproduct}: java.lang.NullPointerException
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.os.Looper.loop(Looper.java:123)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.app.ActivityThread.main(ActivityThread.java:3683)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at java.lang.reflect.Method.invokeNative(Native Method)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at java.lang.reflect.Method.invoke(Method.java:507)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at dalvik.system.NativeStart.main(Native Method)
10-09 13:01:01.951: E/AndroidRuntime(2135): Caused by: java.lang.NullPointerException
10-09 13:01:01.951: E/AndroidRuntime(2135):     at com.androidhive.xmlparsing.Detailsofproduct.onCreate(Detailsofproduct.java:209)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-09 13:01:01.951: E/AndroidRuntime(2135):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-09 13:01:01.951: E/AndroidRuntime(2135):     ... 11 more

Why am i getting the error. Any helps??

  • 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-12T12:33:43+00:00Added an answer on June 12, 2026 at 12:33 pm

    Change this,

      btn=(ImageButton)findViewById(R.id.cartbutton);
    

    to

     btn=(ImageButton)actionbar1.findViewById(R.id.cartbutton);
    

    Maybe referencing the view from where it originates should do the trick.

    Because normally when you call findViewbyId(), android searches for the element only from the xml used in setContentView, since you are using a action bar view this should help.

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

Sidebar

Related Questions

am getting this exception: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{business.premium/business.premium.Problemio}: java.lang.ClassNotFoundException: business.premium.Problemio at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
I am getting this exception in the LogCat: Unable to start service Intent {
i'm getting exception on Transformer transformer = tFactory.newTransformer(StreamXSL); but the error below is not
In the code below I keep getting a null exception error and have tested
I'm getting an Unable to obtain public key for StrongNameKeyPair. exception using Newtonsoft's JsonConvert.SerializeObject
Iam trying to authenticate to https url , but iam getting exception . Below
I am getting an exception error, Input string was not in a correct format.
I am getting this exception: Collection was modified; enumeration operation may not execute. Directly
I'm getting to grips with EF4 code first, and liking it so far. But
I'm unable to find out why am I getting this exception despite initializing the

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.