I would like to pass String array and String variable to my AsyncTask class. I am new to programming android apps so It is possible that this is not the most efficient way to achieve my goal. Anyways, I have String array called separate[] and String selected.
In separate[] I have loaded values from EditText View and in selected, there is a value from my spinner. Now I want to work with these in my AsyncTask. My AsyncTask class looks now like this:
final class cyklus extends AsyncTask<String[], Void, String[]>{
String[] tones = {"C","Cis","D","Dis","E","F","Fis","G","Gis","A","Ais","B"};
String[] result;
@Override
protected String[] doInBackground(String[]... params) {
int l =params.length; //length of separate[]
for(int k=0; k==l; k++){ // finding indexes of matches of elements separate[k] in tones[]
// INPUT POSITION
int i= Arrays.asList(tones).indexOf(params[k]);
// RESULT INDEX
int j =Integer.parseInt(selected);
int index = i+j;
// RESULT
String res=tones[index];
result[k]=res;
}
return result;
}
}
After this for loop is done, I would like my AsyncTask to return result[]. To sum up tis, I would like to know how can I work with "separate[]" and "selected" in my AsyncTask class. Thank you.
EDIT: One more subquestion. My for loop wont start. Why? Thank you.