If you think the Android project frc-notebook 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.plnyyanks.frcnotebook.datafeed;
/*fromwww.java2s.com*/import android.app.Activity;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.plnyyanks.frcnotebook.Constants;
import com.plnyyanks.frcnotebook.activities.StartActivity;
import com.plnyyanks.frcnotebook.background.ShowLocalEvents;
import com.plnyyanks.frcnotebook.database.PreferenceHandler;
import com.plnyyanks.frcnotebook.datatypes.Event;
import com.plnyyanks.frcnotebook.datatypes.Team;
import com.plnyyanks.frcnotebook.json.JSONManager;
import java.util.Iterator;
/**
* File created by phil on 2/19/2014.
* Copyright 2014, Phil Lopreiato
* This file is part of FRC Notebook.
* FRC Notebook is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* FRC Notebook is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with FRC Notebook. If not, see http://www.gnu.org/licenses/.
*/publicclass EventDetailFetcher extends AsyncTask<String,String,String> {
privatestatic Activity activity;
privatestatic String event;
public EventDetailFetcher(Activity parentActivity, String eventKey){
activity = parentActivity;
event = eventKey;
}
@Override
protected String doInBackground(String... strings) {
if(PreferenceHandler.getDataSource() == Constants.DATAFEED_SOURCES.TBAv1)
return TBADatafeed.fetchEventDetails_TBAv1(event);
elsereturn TBADatafeed.fetchEventDetails_TBAv2(event);
}
@Override
protectedvoid onPostExecute(String s) {
super.onPostExecute(s);
Toast.makeText(activity,s,Toast.LENGTH_SHORT).show();
if(ShowLocalEvents.adapter!=null){
ShowLocalEvents.adapter.notifyDataSetChanged();
}
}
}