- 源码类别:进度条Process
- 源码大小:9.2 MB
- 编码格式:gbk,utf8,不限
- 运行环境:php+mysql
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
//3.设置通知 三要素 标题、小图标、内容
builder.setContentTitle("下载中...")
.setSmallIcon(R.mipmap.ic_launcher);
//开启异步任务
new ImgAsync(new ImgAsync.CallBack() {
@Override
public void getProgress(int progress) {
builder.setContentText("下载了" + progress + "%");
builder.setProgress(100, progress, false);
if (progress == 100) {
builder.setContentTitle("点击查看")
.setContentText("下载完成");
//点击通知 跳转 封装跳转意图 PendingIntent.FLAG_ONE_SHOT有效点击次数一次
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
PendingIntent pendingIntent =
PendingIntent.getActivity(MainActivity.this, 100, intent, PendingIntent.FLAG_ONE_SHOT);
builder.setContentIntent(pendingIntent);
}
//发送通知
manager.notify(100, builder.build());
}
}).execute(path);
本站资源仅限于学习研究,严禁从事商业或者非法活动!
源码搜藏网所有源码来自互联网转载与用户上传分享,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!