Thursday, August 16, 2012

Re: [android-developers] Beginner question : "The type of the expression must be an array type but it resolved to double"

you declared double P_N_comp but you are using P_N
check out your P_N declaration.


Luiz

2012/8/13 jg <jg.enault@gmail.com>
Hello,

Before anything, I would like to mention that I am new to Android develoment, and java as well...
So please, apologize in advance if I ask a "stupid" question (but there is no such thing as a stupid question, is it ;) ? ), or if I do anything wrong in this post (I figured out it might be easier for you if I do not post the whole code... but maybe I am wrong ?).

So far, I could write the first lines of an android application, but i get an issue on which I would need some help...



I have created a bi-dimensionnal array 16*40 :

[CODE]
public double P_N_comp[][] = new double[16][40];
[/CODE]

Later in the code, I populate this array with a function.

At the end, I want to access the last value stored in my array, and display it on a textview :

[CODE]
        Double last_P_N = P_N[15][39];      // This is the line where i get the error
        TextView myTextView3 = (TextView) findViewById(R.id.mytextview3);
        myTextView3.setText("Last P_N value" + last_P_N);
[/CODE]

And i get this annoying error which says :
"The type of the expression must be an array type but it resolved to double"

From what I understand, it looks like Java is expecting to have an array in the expression "Double last_P_N = P_N[15][39]"
But I don't understand why because P_N[15][39] refers to the the very last value of my array, which is defined in order to store DOUBLE values... and on the other end of the expression, I just defined the variable last_P_N as DOUBLE.


Thank you in advance,

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment