Android Open Source - HackWinds Forecast Fragment






From Project

Back to project page HackWinds.

License

The source code is released under:

MIT License

If you think the Android project HackWinds listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nucc.hackwinds;
//w w  w. jav a2s.co  m
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


public class ForecastFragment extends ListFragment {
    // Declare member variables
    private ForecastModel mForecastModel;
    private ForecastArrayAdapter mForecastArrayAdapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Initialize forecast model
        mForecastModel = ForecastModel.getInstance();

        // Get the forecast data
        new BackgroundForecastAsyncTask().execute();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View V = inflater.inflate(R.layout.forecast_fragment, container, false);
        return V;
    }

    class BackgroundForecastAsyncTask extends AsyncTask<Void, Void, Void> {
        @Override
        protected Void doInBackground(Void... arg0) {

            // Forecast data
            mForecastModel.getForecasts();

            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);

            // Set the forecast adapter to the listview
            mForecastArrayAdapter = new ForecastArrayAdapter(getActivity(), mForecastModel.forecasts);
            setListAdapter(mForecastArrayAdapter);
        }
    }
}




Java Source Code List

com.nucc.hackwinds.BuoyArrayAdapter.java
com.nucc.hackwinds.BuoyFragment.java
com.nucc.hackwinds.BuoyModel.java
com.nucc.hackwinds.Buoy.java
com.nucc.hackwinds.CamFragment.java
com.nucc.hackwinds.ConditionArrayAdapter.java
com.nucc.hackwinds.ConditionModel.java
com.nucc.hackwinds.Condition.java
com.nucc.hackwinds.CurrentFragment.java
com.nucc.hackwinds.ForecastArrayAdapter.java
com.nucc.hackwinds.ForecastFragment.java
com.nucc.hackwinds.ForecastModel.java
com.nucc.hackwinds.Forecast.java
com.nucc.hackwinds.MainActivity.java
com.nucc.hackwinds.ServiceHandler.java
com.nucc.hackwinds.TideArrayAdapter.java
com.nucc.hackwinds.TideFragment.java
com.nucc.hackwinds.TideModel.java
com.nucc.hackwinds.Tide.java