美文网首页Android基础知识
IntentService使用方法

IntentService使用方法

作者: Mayo酱 | 来源:发表于2017-09-20 23:39 被阅读0次
public class IntentService extends android.app.IntentService{

    //两个方法必须实现,构造方法和onHandleIntent


    /**
     * Creates an IntentService.  Invoked by your subclass's constructor.
     *
     * @param name Used to name the worker thread, important only for debugging.
     */
    public IntentService(String name) {
        //name表示他的线程名称
        super(name);
    }

    //实现异步任务的方法,Activity传过来的intent,数据包含在intent中
    @Override
    protected void onHandleIntent(@Nullable Intent intent) {

    }
}

相关文章

网友评论

    本文标题:IntentService使用方法

    本文链接:https://www.haomeiwen.com/subject/inmasxtx.html