Android Open Source - AndroidNetworkKit A N Handler






From Project

Back to project page AndroidNetworkKit.

License

The source code is released under:

Apache License

If you think the Android project AndroidNetworkKit 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.mindblowninnovation.ank;
//ww w.  ja v  a  2 s.c o m

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;

public abstract class ANHandler extends Handler
{
  public void handleMessage(Message msg)
  {
      Log.d("Munchful Handler", "Got message");
        super.handleMessage(msg);
        //What did that async task say?
        switch (msg.what) {
            case 1://OK
                Log.d("Handler", "Got OK result");
                resultOK(msg);
                break;       
            case 2://failed
              Log.d("Handler", "Got failed result");
              resultFailed(msg);
              break;
            case 3:
              Log.d("Handler", "Got no internet result");
              resultFailed(msg);
              break;
        }
    }
  public void resultNoInternet(Context context){
    Toast.makeText(context, "Sorry, no internet detected!", Toast.LENGTH_SHORT).show();
  }
  //abstract methods
  public abstract void resultOK(Message msg);
  public abstract void resultFailed(Message msg);
}




Java Source Code List

com.mindblowninnovation.ank.ANHandler.java
com.mindblowninnovation.ank.ANTask.java
com.mindblowninnovation.ank.ANUtils.java
com.mindblowninnovation.ank.Album.java
com.mindblowninnovation.ank.Artist.java
com.mindblowninnovation.ank.Image.java
com.mindblowninnovation.ank.MainActivity.java
com.mindblowninnovation.ank.Track.java