package com.example.android.sunshine.app;

import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import java.util.ArrayList;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment())
                    .commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * 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);

            ArrayList<String> weatherList = new ArrayList<String>();
            weatherList.add("Today - Sunny - 88/63");
            weatherList.add("Tomorrow - Foggy - 70/46");
            weatherList.add("Weds - Cloudy - 72/63");
            weatherList.add("Thurs - Rainy - 64/51");
            weatherList.add("Fri - Foggy - 70/46");
            weatherList.add("Sat - Sunny - 76/68");
            
            ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
                    R.layout.list_item_forecast, R.id.list_item_forecast_textview, weatherList);
            return rootView;
        }
    }
}

@@ -335,16 +335,48 @@
 Adapter;
+%0Aimport android.widget.ListView;
 %0A%0Aimport
@@ -1692,16 +1692,71 @@
 agment %7B
+%0A        private ArrayAdapter%3CString%3E mForecastAdapter;
 %0A%0A      
@@ -1788,17 +1788,16 @@
 ent() %7B%0A
-%0A
         
@@ -2439,28 +2439,16 @@
 6/68%22);%0A
-            
 %0A       
@@ -2473,17 +2473,26 @@
 String%3E 
-a
+mForecastA
 dapter =
@@ -2629,16 +2629,159 @@
 rList);%0A
+%0A            ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast);%0A            listView.setAdapter(mForecastAdapter);%0A%0A
         

add adapter to listview