I have to retrieve some data from a file to show it in a chart. The function that shows the chart requires he data as float[] whereas the retrieved data is in the form ArrayList<String>.
What is the easiest way to convert ArrayList<String> to float[]?
try {
FileInputStream fIn = context.openFileInput(fileDir+fileName);
InputStreamReader ipsr = new InputStreamReader(fIn);
BufferedReader b = new BufferedReader(ipsr);
ArrayList<String> list_prix = new ArrayList<String>();
String ligne;
while ((ligne = b.readLine()) != null) {
String dtVal = ligne.split(" ")[2];
dtVal = dtVal.substring(0, dtVal.length() - 2);
list_prix.add(dtVal);
}
//just here if i can convert list_prix to float[]
fIn.close();
ipsr.close();
}
catch (Exception e)
{
Log.e("blah", "Exception", e);
}
Thank you for your help.