/** * Run an array of functions in series, each one running once the previous function has completed. * If any functions in the series pass an error to its callback, * no more functions are run and outcome for the series is immediately called with the value of the error. * * @param outcome * @param functions */ public void series(final Outcome outcome, final Function... functions) { _series(null, outcome, functions); // generic signature problem, hence null }
var github = new Async("https://api.github.com/users/john/repos") github.create(callback); function callback(){ github.createList("name"); github.createList("id"); }
var github = new Async("https://api.github.com/users/john/repos") github.create(); github.req.onload = function () { github.createList("name"); github.createList("id"); }
public void getAddress(LatLng latLng) throws IOException { URL url = new URL("https://maps.googleapis.com/maps/api/geocode/json?latlng="+latLng.latitude+","+latLng.longitude+"&key=AIza***********************"); Async async =new Async(); async.execute(url); //JSONArray response = async.jsonArray; //return response; }
AutoCompleteTextView autoCompView = (AutoCompleteTextView) rootView.findViewById(R.id.searchLocation); autoCompView.setThreshold(3); autoCompView.setAdapter(new PlacesAutoCompleteAdapter(getActivity(), android.R.layout.simple_list_item_1)); autoCompView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String PARAMETERS = resultList.get(arg2).getRef(); Log.e("ref string", PARAMETERS); new Async().execute("" + PARAMETERS); } });
/** * Runs an array of functions in series, working on a shared context. * However, if any of the functions pass an error to the callback, * the next function is not executed and the outcome is immediately called with the error. * * @param context * @param outcome * @param functions */ public void waterfall(final C context, final Outcome<C> outcome, final Function<C>... functions) { _series(context, outcome, functions); }
var async = new Async(); async.complete = function(status, statusText, responseText, responseXML, obj) { if (status == 200) {
cd = new ConnectionDetector(getApplicationContext()); isInternetPresent = cd.isConnectingToInternet(); // check for Internet status if (isInternetPresent) { // Internet Connection is Present // make HTTP requests //showAlertDialog(AndroidDetectInternetConnectionActivity.this, "Internet Connection","You have internet connection", true); Intent myIntent = getIntent(); newurl=url+"="+myIntent.getSerializableExtra("catname").toString(); new Async().execute(); } else { // Internet connection is not present // Ask user to connect to Internet showAlertDialog(AndroidJSONParsingActivity.this, "No Internet Connection", "You don't have internet connection.", false); }