My app redirects from home screen to city screen through the tap of a button. After I go the city screen. I'm trying to populate a spinner(id = countries). But, when I run it eclipse it opens up an empty spinner in my city class.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_city);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v = inflater.inflate(R.layout.fragment_city, container, false);
String[] test = {"test1", "test2"};
Spinner spin = (Spinner) v.findViewById(R.id.countries);
ArrayAdapter<String> adapt = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, test);
adapt.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spin.setAdapter(adapt);
return v;
}