I am trying to access the method local variable and assign to a global variable and try to access it to other methods code is working fine for local but not assigned to the global variable here is my code
global variable String spinner;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view= inflater.inflate(R.layout.fragment_players, container, false);
//I want to get value here
}
//private void Spinner(List<String> list)
{
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (i>0)
{
String text= spinner.getSelectedItem().toString();
spinnerText=text;
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}