0

Keep getting ArrayIndexOutOfBoundsException when trying to display a specific item form array list data displays fine in logcat but then after displaying throws exception at top please help is the code kind of new to android

public void loadData(){
        InputStream file = ourContext.getResources().openRawResource(R.raw.cashpot);
        BufferedReader reader = new BufferedReader(new InputStreamReader(file));       
        String line ="";
        ArrayList<String> values = new ArrayList<String>();
        try {
            while((line = reader.readLine()) != null) { 
                values.add(line);
              //  String[] strings = line.split(",");


                /*for(String s : strings) {
                    values.add(s);
                }*/

            }
            reader.close();
            //for(String s : values) Log.d("CSV Test", s);
            for(int i = 0; i < values.size();i++){
                String[] data = values.get(i).split(",");
                Log.d("Test String",data[2] );

            }
        } catch (IOException e) {
            e.printStackTrace();
        }



    }
4

2 に答える 2