Android Open Source - Bussan Bussan Async Task






From Project

Back to project page Bussan.

License

The source code is released under:

Copyright 2011 Kristian Bendiksen. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project Bussan 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 no.kriben.bussan;
/*from  w w w .j  a v a 2 s . c o  m*/
import android.app.Activity;
import android.os.AsyncTask;

// Async task which connects to an application instance.
// Code adapted from 
// http://www.fattybeagle.com/2011/02/15/android-asynctasks-during-a-screen-rotation-part-ii/
//
public abstract class BussanAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
    protected BussanApplication application_;
    protected Activity activity_;

    public BussanAsyncTask(Activity activity) {
        activity_ = activity;
        application_ = (BussanApplication) activity_.getApplication();
    }

    public void setActivity(Activity activity) {
        activity_ = activity;
        if (activity_ == null) {
            onActivityDetached();
        }
        else {
            onActivityAttached();
        }
    }

    protected void onActivityAttached() {}

    protected void onActivityDetached() {}

    @Override
    protected void onPreExecute() {
        application_.addTask(activity_, this);
    }

    @Override
    protected void onPostExecute(Result result) {
        application_.removeTask(this);
    }

    @Override
    protected void onCancelled() {
        application_.removeTask(this);
    }
}




Java Source Code List

no.kriben.bussan.AndroidFileStringCache.java
no.kriben.bussan.BusDepartureDetailActivity.java
no.kriben.bussan.BusStopAdapter.java
no.kriben.bussan.BusStopArrayAdapter.java
no.kriben.bussan.BusStopListActivity.java
no.kriben.bussan.BusStopMenuHandler.java
no.kriben.bussan.BusStopNameFormatter.java
no.kriben.bussan.BusStopWithDistance.java
no.kriben.bussan.BussanApplication.java
no.kriben.bussan.BussanAsyncTask.java
no.kriben.bussan.ConnectivityChecker.java
no.kriben.bussan.FindBusStopByDistanceActivity.java
no.kriben.bussan.FindBusStopByNameActivity.java
no.kriben.bussan.FrontpageActivity.java
no.kriben.bussan.PreferencesUtil.java
no.kriben.bussan.RealTimeActivity.java