Problem using PutExtra with a vector

0

I can not get the vector inside PutExtra. Can anyone help me?

Activity 1

 double[] valores = new double[vetorEdits.length];



            for (int i = 0; i < vetorEdits.length ; i++) {

                valores[i] = Double.parseDouble( vetorEdits[i].getText().toString());


            }

            Intent intent = new Intent(getApplication(),Main5Activity.class);
            intent.putExtra("valores", valores[vetorEdits.length]);
            startActivity(intent);

Activity 2

Intent intent = getIntent();

    double[] valores = getIntent().getDoubleExtra("valores", 0,0);
    
asked by anonymous 11.11.2017 / 18:46

1 answer

2

What you are putting in the add-ons is a double and not an array,

valores[vetorEdits.length]

is a double, one that is stored in index vetorEdits.length .

I even think that this line should be failing.

You should use this:

intent.putExtra("valores", valores);

To recover it you should use

double[] valores = getIntent().getDoubleArrayExtra("valores");
    
11.11.2017 / 18:55