Back to project page HackWinds.
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.
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); } } }