Code example for Toast

Methods: setGravityshow

0
                if (mToast != null) {
                    mToast.cancel();
                } 
                mToast = Toast.makeText(mContext, string, duration);
                if (centered) {
                    mToast.setGravity(Gravity.CENTER, 0, 0);
                } 
                mToast.show();
            } 
       }); 
    } 
 
    public void dismissToast() { 
        mHandler.post(new Runnable() {
            public void run() { 
                if (mToast != null) {
                    mToast.cancel();
                } 
            } 
        }); 
    }