Dynamic variable names in Java
Go to solution
Solved by Mr_KoKa,
If your names are in order like, 1, 2, 3 .. or 0, 1, 2 ... you can use ArrayList, examples described there: http://javarevisited.blogspot.com/2011/05/example-of-arraylist-in-java-tutorial.html
If your names aren't in order so there would be gaps between indexes, or if there are names other than numeric you can use HashMap: http://java67.blogspot.com/2013/02/10-examples-of-hashmap-in-java-programming-tutorial.html
Creating your ArraList remeber to provide valid type into <> brackets in Your case it will be <WebView> in case of ArrayList and <Integer, WebView> or <String, WebView> in case of HashMap.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now