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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:22:23+00:00 2026-06-08T12:22:23+00:00

First time posting. Thanks for the help in advance. I have two activities. First

  • 0

First time posting. Thanks for the help in advance.

I have two activities. First activity reads in 3 numbers from the user via edittext fields whose inputType is “numberDecimal”. It bundles these and sends them to the second activity via intent.

The second activity reads in the 3 numbers. It then needs to multiply them by some constants. That’s where the problem comes in. If the result of the multiplication is too large (say, greater than a couple hundred…not constant threshold…not close to what a double should be able to hold) then it throws an indexoutofboundsexception.

//@SuppressWarnings ("serial)")
public class CreationActivity extends Activity {

@Override
public void onCreate (Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.creation);
    TextView txtTitle = (TextView) findViewById(R.id.labelTitle);
    TextView txtArtist = (TextView) findViewById(R.id.labelArtist);
    TextView txtTime = (TextView) findViewById(R.id.labelTitle);

    try {
        Bundle extras = getIntent().getExtras();
        double Hours;
        double Minutes;
        double Seconds;

        if (extras!=null){
            double timerTime[] = extras.getDoubleArray("Time");
            Hours = timerTime[0];
            Minutes = timerTime[1];
            Seconds = timerTime[2];
                            //next line is where the error happens:
            double desired_time = timerTime[0] * 5000;
                            //do some stuff
        }else{
            txtTitle.setText("No data");
        }
    } catch (NumberFormatException e){
    }
}
}   

And the LogCat is:

07-27 21:58:41.736: E/AndroidRuntime(31560): FATAL EXCEPTION: main
07-27 21:58:41.736: E/AndroidRuntime(31560): java.lang.RuntimeException: Unable to start     activity ComponentInfo{com.decker.timer/com.decker.timer.CreationActivity}:    java.lang.IndexOutOfBoundsException: Invalid index 4, size is 4
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.os.Handler.dispatchMessage(Handler.java:99)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.os.Looper.loop(Looper.java:137)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.ActivityThread.main(ActivityThread.java:4424)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at java.lang.reflect.Method.invokeNative(Native Method)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at java.lang.reflect.Method.invoke(Method.java:511)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at dalvik.system.NativeStart.main(Native Method)
07-27 21:58:41.736: E/AndroidRuntime(31560): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 4, size is 4
07-27 21:58:41.736: E/AndroidRuntime(31560):    at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at java.util.ArrayList.get(ArrayList.java:304)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at com.decker.timer.CreationActivity.onCreate(CreationActivity.java:172)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.Activity.performCreate(Activity.java:4465)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-27 21:58:41.736: E/AndroidRuntime(31560):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
07-27 21:58:41.736: E/AndroidRuntime(31560):    ... 11 more
07-27 21:58:49.260: D/TimerActivity(31583): onClicked
  • 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-08T12:22:25+00:00Added an answer on June 8, 2026 at 12:22 pm

    It sounds like you are trying to access the 5th (item at position 4) item in an array of length four.

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

Sidebar

Related Questions

Thanks for the help in advance. First time posting here. I have included a
this is my first time posting on StackOverflow but this site is awesome. Thanks
first time posting here so be gentle :) On my web pages I have
my first time posting. I have a tricky task of finding the latest date
this is my first time posting here, I have a question which I have
this is my first time posting on here and have read alot of helpful
This is my first time posting to stackoverflow, but these threads have helped me
this is my first time posting my problem here, i hope i get help
First time posting. So I have to format some text in a element that
This is my first time posting so bear with me. I have a file

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.