自定义View继承现有的Toast,实现订单提醒的Toast,从左下角显示然后退出

自定义View继承现有的Toast,实现订单提醒的Toast,从左下角显示然后退出





/**
 * Created by  on 16-2-4.
 */
public class NotifyToast extends Toast {
    private long lastShowTime;
    public static NotifyToast instance;
    public static synchronized NotifyToast getInstance(Context context){
        if(instance==null){
            instance = new NotifyToast(context,"你有未处理的订单,请抓紧处理",3000);
        }
        return instance;
    }

    private MediaPlayer mPlayer;
    /**
     * Construct an empty Toast object.  You must call {@link #setView} before you
     * can call {@link #show}.
     *
     * @param context The context to use.  Usually your {@link Application}
     *                or {@link Activity} object.
     */
    public NotifyToast(Context context,CharSequence text, int duration) {
        super(context);
        mPlayer = MediaPlayer.create(context, R.raw.neworder);
        //2016年08月02日10:51:32 不需要设置完成后释放资源的回调,整段注释掉了
//       
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值