I am trying to populate fake data using Fragments/ListView/Arrays & Adapter. but when i run the App , i am getting blank screen, Please guide::
below is my MainActivity.Java codes within Fragment class::
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView= inflater.inflate(R.layout.fragment_main, container, false);
String[] forecastArray = {
"Today , Sunny , 88/63",
"Tomorrow , Sunny , 88/63",
"Wesneday , Sunny , 88/63",
"THursday , Sunny , 88/63",
"FRIDAY , Sunny , 88/63",
"Saturday , Sunny , 88/63",
"Sunday , Sunny , 88/63",
};
List<String> weekForecast = new ArrayList<String>(
Arrays.asList(forecastArray)
);
ArrayAdapter<String> mForecastAdapter;
mForecastAdapter = new ArrayAdapter<String>(
getActivity(),
R.layout.list_item_forecast,
R.id.List_item_forecast_textView, weekForecast);
ListView listView = (ListView) rootView.findViewById(R.id.listView_forecast);
listView.setAdapter(mForecastAdapter);
return rootView;
}