Michael Jancen-Widmer Michael Jancen-Widmer - 4 months ago 45
Java Question

Android: Java Error Unexpected token (Array)

I am facing an error which isn't in fact an error. I am using Android Studio and want to create an Array but it tells me that there are unexpected token..

enter image description here

As you can see in the image I wanted to make a String Array, but things are not going as supposed to. Is this an error with Android Studio?

Answer

Move it to onCreate() and try again.

Or you may use as below

new way