the condition buffer[i]!='\n' is never met so i gets larger than the array size i think what you need is buffer[i]!=null. '\n' is the new line character which is never in your array
On Sep 11, 1:35 pm, Asif k <[email protected]> wrote: > Hi all, > > I am getting null pointer exception at the bellow mentioned line in > the for loop. > > char[] buffer= {'s','d','c'}; > char[] test; > > for(int i=0; buffer[i]!='\n';i++) { > test[i] = buffer[i]; ////////// This line gives Null pointer > Exception at runtime > > } > > I am getting the same error in each for loop where I am equating > something. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

