3

This exception is being thrown:

Caused by: java.lang.IllegalArgumentException: No view found for id 0x7f0e006b (com.example.simplegamer003.sunshine.app:id/container) for fragment MainActivityFragment{37dff01 #1 id=0x7f0e006b FFTAG}

Code causing the exception:

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {

    mForecastAdapter = new ForecastAdapter(getActivity(), null, 0);

    View rootView = inflater.inflate(R.layout.fragment_main, container, false);

    // Get a reference to the ListView, and attach this adapter to it.
    ListView listView = (ListView) rootView.findViewById(R.id.listView_forecast);
    listView.setAdapter(mForecastAdapter);

    // We'll call our MainActivity
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            // CursorAdapter returns a cursor at the correct position for getItem(), or null
            // if it cannot seek to that position.
            Cursor cursor = (Cursor) adapterView.getItemAtPosition(position);
            if (cursor != null) {
                String locationSetting = Utility.getPreferredLocation(getActivity());
                Intent intent = new Intent(getActivity(), DetailActivity.class)
                        .setData(WeatherContract.WeatherEntry.buildWeatherLocationWithDate(
                                locationSetting, cursor.getLong(COL_WEATHER_DATE)
                        ));
                startActivity(intent);
            }
        }
    });
    return rootView;
}
Khalos
  • 2,335
  • 1
  • 23
  • 38

1 Answers1

1

try this : View rootView = inflater.inflate(R.layout.fragment_main, null, false);instead of View rootView = inflater.inflate(R.layout.fragment_main, container, false); I think container is null. hope it helps you

Mangesh Sambare
  • 594
  • 3
  • 23