You cannot change the size of an array. If you want to contain more elements, you need to create a new array. Another option is to write ArrayList.
List<String> where = new ArrayList<String>();
where.add( ContactsContract.Contacts.HAS_PHONE_NUMBER+"=1" );
where.add( ContactsContract.Contacts.IN_VISIBLE_GROUP+"=1" );
You can use it like this. And if you want to re-arrange this into a string array,
String[] simpleArray = new String[ where.size() ];
where.toArray( simpleArray );
You can do it like this. But most of the things you can do with an array, you can do with an ArrayList.
© 2024 OneMinuteCode. All rights reserved.