I am getting string from a php file at server side using retrofit 1.9 in android M like this -
...
String output = "";    
try {         
           BufferedReader reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
           output = reader.readLine();
    } 
catch (IOException e) {
           ...
    }
    });
    }
    arr = output.split("-");
    textviewvar.setText(arr[0]);
...
I have tested that the output string contains HelloWorld-2017 and when  I displayed individual array element arr[0] and arr[1] using Toast, they were displayed as expected.
But when I am trying to setText(arr[0]), the app crashes!!!
I know that the array element is not empty as I have checked them everytime.
What should I do?
Edit: I tried setContentView(R.layout.activity_main) but the app continues to crash.
In the method protected void onCreate(Bundle savedInstanceState) I have  initialized textviewvar whereas the variable has class scope.
