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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:24:09+00:00 2026-05-31T01:24:09+00:00

I have a weird problem in the setup of my Android application which is

  • 0

I have a weird problem in the setup of my Android application which is to do with me passing values between differen classes(or screens). Basically i have a menu class that passes to this class(classA) and then third class(classB). ClassA has a button to go to classB which will then do an operation and pass doubles back to classA.

The problem lies within these lines of code:

Intent it = getIntent();        
    if (it != null)
    {
        Bundle b = getIntent().getExtras();
        double result = b.getDouble("weight");
        double result2 = b.getDouble("height");
        if((result > 0)&&(result2 > 0))
        {
            mDateDisplay.setText("weight: "+result+"height"+result2);
        }
    }
    else
    {
        //do nothing
    }

the problem is that it crashed the app when i come to the screen from the menu i have set up. initailly i had no idea what the problem was but then i realised that the problem lies with the intent. due to me coming from a previous screen there is an intent sent to this class. so when it checks for null intent it finds the intent sent from the menu. this means that running the if statement will happen and cause an error.

i’m wondering if there is a solution to this problem.

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

    As I understand it, this code is failing because it receives an Intent that it’s not equipped to handle. It tries to get a double from an Intent that doesn’t contain a double.

    The solution is to differentiate your Intents so that you only call code when you know you’ve received the Intent that goes with that code. That is, some aspect of each Intent you use should be unique, so that you can tell Intent A from Intent B.

    The best way to do this is to create your own custom Intent action, using a namespace you own or control, such as “com.example.mydomain.intent.intent1”. That way, you can test to see if the incoming intent is the one you want to handle.

    If you’re passing intents around in your application, and you don’t outsiders to use them, then don’t use intent filters. Instead, create the intent based on the ComponentInfo of the target activity. You can still use actions.

    A fault of the code you’re showing here is that it will get called for any incoming intent, and if you’re using intent filtering, you could accidentally receive an intent from another application! In general, either use strong intent filtering or send intents by component name, and always test intents in your code before you act on them.

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

Sidebar

Related Questions

Today I faced a strange problem. I have an application which is the same
I have setup two timers in my application which both repeats every a few
i have a weird problem with my local Testing-Setup of a simple Java URL
I have weird problem. I'm using Eclipse for writing J2EE (java, jsf, javascript) application
I have very weird problem with web-services. Setup is following: 6 web-services deployed on
I have a weird problem. I am trying to setup User Defined Runtime Attribute
i have a weird problem. i would like to delete an assembly(plugin.dll on harddisk)
I have a weird problem with images in visual web developer, I cant change
I have a weird problem where after setting nocheck on a foreign constraint and
I have this weird problem with setting up cookies with PHP. Everything worked fine

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.