通过service下载我已经实现,但是点击图标,打死也调不出下载的界面?
private void setupNotification() {
mRemoteView = new RemoteViews(this.getPackageName(), R.layout.y_item_notifymessage);
mNotification.contentView = mRemoteView;
intent = new Intent(this, Y_Activity_DownManage.class);
pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
mNotification = new Notification.Builder(ctx)
.setAutoCancel(true)
.setContentTitle("title")
.setContentText("describe")
.setContentIntent(pendingIntent)
.setContent(mRemoteView)
.setTicker("开始下载")
.setSmallIcon(R.drawable.ic_launcher)
.setWhen(System.currentTimeMillis())
.build();
mNotificationManager = (NotificationManager) getSystemService( android.content.Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(10, mNotification);
}
下载类:
public class DownloadService extends Service implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
setupNotification();
//clearNotification();
}
}
做法类似百度传课的下载!或者慕课的下载!
------解决思路----------------------
你的上下文,试试activity不是你的application