Let me use my telepathic abilities(I have to since you did not provide
the error information)...

You are getting ArrayIndexOutOfBoundsException.

And there is a long list of issues here:
 -  i<=daty.length - This one will always result in an
ArrayIndexOutOfBoundsException
 - using datx[i+1] will cause ArrayIndexOutOfBoundsException if used
without thought
 - And the list goes on an on, but you would not want to hear it...

http://goo.gl/OkYcW

On Jun 22, 1:16 am, Vini <vinic...@gmail.com> wrote:
> Hi, I want a funtion graph in android.
> I have two arrays (x e y) and want graph with draw line, but throws me
> an error "the application has stopped unexpectedly ". I probe drawline
> one to one and works
>
> protected void onDraw(Canvas canvas) {
>                 int [] datx= {30,40,60,80,100};
>                 int [] daty = {20,60,90,60,100};
>
> /*canvas.drawLine(datx[1],daty[1],datx[2],daty[2]  ,paint);
>                 canvas.drawLine(datx[2],daty[2],datx[3],daty[3]  ,paint);
>                 canvas.drawLine(datx[3],daty[3],datx[4],daty[4]  ,paint);
> */
>
>                 for(int i=0; i<=daty.length; i++){
>
>                         canvas.drawLine(datx[i],daty[i],datx[i+1],daty[i+1]  
> ,paint);
>
>                         }
>
>                         }

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to