Sambhaji kokate
Newbie
I have following code in my main Activity.
In Android Studio it does not give any error for this code.But when I launch Activity it's display nothing and gets stopped. When I changed this code as follows it worked. I am not understanding problem with above code.
Working code:
Code:
private List<Notes> chap = new ArrayList<>();
Resources res = getResources();
String[] chap1Titles = res.getStringArray(R.array.Introductiontitles);
String[] chap1Notes = res.getStringArray(R.array.Introductionnotes);
private void initializeData(){
chap.add(new Notes(chap1Titles[0],chap1Notes[0]));
chap.add(new Notes(chap1Titles[1],chap1Notes[1]));
}
In Android Studio it does not give any error for this code.But when I launch Activity it's display nothing and gets stopped. When I changed this code as follows it worked. I am not understanding problem with above code.
Working code:
Code:
private List<Notes> chap = new ArrayList<>();
private void initializeData(){
chap.add(new Notes("Introduction ","About Introduction topic"));
chap.add(new Notes("Motion ","About Motion topic"));
}
Last edited by a moderator: