• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps help with arraylist

i have an arraylist with many elements i want to get some of this elements and put them in another arraylist
when i use array.get()
and then array.add()
it return many errors as nullpointerException and RuntimeException

Null pointer exception means that the reference "array" was never instantiated. You can do this by calling array = new ArrayList<Some Class Name that you are storing here>(); http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones