嗨,我想通过这种方法将新字符串添加到字符串数组,但它不起作用,因为当我开始新活动时,favaorites 数组不会更新。为什么 ?
Resources res = getResources();
String[] favorites = res.getStringArray(R.array.favorites);
String[] planets = res.getStringArray(R.array.planets_array);
String[] temp = new String[favorites.length+1];
System.arraycopy(favorites,0,temp,0,favorites.length);
temp[favorites.length] = planets[mCounter];
favorites = temp;