我做的是一个在线更新功能,然后在通告栏里用进度条显示下载安装包的进度,下载完成后,点击通告栏安装下载的软件,不幸的是下载没有任何异常,下载完后点击通告栏就报异常:
08-16 11:34:15.034: ERROR/JavaBinder(11290): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
08-16 11:34:15.034: ERROR/JavaBinder(11290): android.util.AndroidRuntimeException: { what=1008 when=52527091 obj=android.os.BinderProxy@47eb1e70 } This message is already in use.
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:171)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Handler.sendMessageAtTime(Handler.java:457)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Handler.sendMessageDelayed(Handler.java:430)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Handler.sendMessage(Handler.java:367)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.view.ViewRoot.dispatchAppVisibility(ViewRoot.java:2750)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.view.ViewRoot$W.dispatchAppVisibility(ViewRoot.java:2950)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.view.IWindow$Stub.onTransact(IWindow.java:153)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Binder.execTransact(Binder.java:288)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at dalvik.system.NativeStart.run(Native Method)
但同时也可以正常的安装下载的软件,下载完成后用的是Message发送一条消息,然后用handlerMessage捕获消息后,做以下处理:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment
.getExternalStorageDirectory(), "appUpdate" + newVerName + ".apk")),
"application/vnd.android.package-archive");
//点击安装软件
updatePendingIntent = PendingIntent.getActivity(DownService.this, 0, intent, 0);
updateNotification.defaults = Notification.DEFAULT_SOUND; //铃声提醒
updateNotification.contentView.setViewVisibility(R.id.update_notification_progressblock, View.GONE);
updateNotification.setLatestEventInfo(DownService.this, "软件更新", "下载完成,点击安装", updatePendingIntent);
//点击安装后自动取消显示通告栏
updateNotification.flags = Notification.FLAG_AUTO_CANCEL;
updateNotificationManager.notify(0,updateNotification);
stopService(updateIntent);设置通告栏不局的代码为:
updateNotification.contentView = new RemoteViews(getPackageName(),R.layout.update_notification);
updateNotification.contentView.setProgressBar(R.id.update_notification_progressbar, 100, 0, false);
updateNotification.contentView.setTextViewText(R.id.update_notification_progresstext, "0%");
updateIntent = new Intent(this, AppUpdateActivity.class);
updatePendingIntent = PendingIntent.getActivity(this,0,updateIntent,0);
updateNotification.contentIntent = updatePendingIntent;
updateNotificationManager.notify(0,updateNotification);
通告栏的布局文件为:update_notification.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:layout_weight="1" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="left|center_vertical">
<ImageView android:layout_height="24dip" android:layout_width="24dip" android:scaleType="fitCenter" android:src="@drawable/logo" />
<TextView android:paddingLeft="5dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:textSize="16dip" android:textColor="#000000" android:text="@string/app_name" />
</LinearLayout>
<LinearLayout android:layout_weight="1" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="left">
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:textSize="14dip" android:textColor="#8F8F8F" android:id="@+id/update_notification_progresstext" />
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/update_notification_progressblock">
<ProgressBar android:id="@+id/update_notification_progressbar"
android:layout_width="260dip"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:layout_gravity="center_vertical"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
请高手看看问题出在哪谢谢了
08-16 11:34:15.034: ERROR/JavaBinder(11290): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
08-16 11:34:15.034: ERROR/JavaBinder(11290): android.util.AndroidRuntimeException: { what=1008 when=52527091 obj=android.os.BinderProxy@47eb1e70 } This message is already in use.
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:171)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Handler.sendMessageAtTime(Handler.java:457)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Handler.sendMessageDelayed(Handler.java:430)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Handler.sendMessage(Handler.java:367)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.view.ViewRoot.dispatchAppVisibility(ViewRoot.java:2750)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.view.ViewRoot$W.dispatchAppVisibility(ViewRoot.java:2950)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.view.IWindow$Stub.onTransact(IWindow.java:153)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at android.os.Binder.execTransact(Binder.java:288)
08-16 11:34:15.034: ERROR/JavaBinder(11290): at dalvik.system.NativeStart.run(Native Method)
但同时也可以正常的安装下载的软件,下载完成后用的是Message发送一条消息,然后用handlerMessage捕获消息后,做以下处理:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment
.getExternalStorageDirectory(), "appUpdate" + newVerName + ".apk")),
"application/vnd.android.package-archive");
//点击安装软件
updatePendingIntent = PendingIntent.getActivity(DownService.this, 0, intent, 0);
updateNotification.defaults = Notification.DEFAULT_SOUND; //铃声提醒
updateNotification.contentView.setViewVisibility(R.id.update_notification_progressblock, View.GONE);
updateNotification.setLatestEventInfo(DownService.this, "软件更新", "下载完成,点击安装", updatePendingIntent);
//点击安装后自动取消显示通告栏
updateNotification.flags = Notification.FLAG_AUTO_CANCEL;
updateNotificationManager.notify(0,updateNotification);
stopService(updateIntent);设置通告栏不局的代码为:
updateNotification.contentView = new RemoteViews(getPackageName(),R.layout.update_notification);
updateNotification.contentView.setProgressBar(R.id.update_notification_progressbar, 100, 0, false);
updateNotification.contentView.setTextViewText(R.id.update_notification_progresstext, "0%");
updateIntent = new Intent(this, AppUpdateActivity.class);
updatePendingIntent = PendingIntent.getActivity(this,0,updateIntent,0);
updateNotification.contentIntent = updatePendingIntent;
updateNotificationManager.notify(0,updateNotification);
通告栏的布局文件为:update_notification.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:layout_weight="1" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="left|center_vertical">
<ImageView android:layout_height="24dip" android:layout_width="24dip" android:scaleType="fitCenter" android:src="@drawable/logo" />
<TextView android:paddingLeft="5dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:textSize="16dip" android:textColor="#000000" android:text="@string/app_name" />
</LinearLayout>
<LinearLayout android:layout_weight="1" android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="left">
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:textSize="14dip" android:textColor="#8F8F8F" android:id="@+id/update_notification_progresstext" />
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/update_notification_progressblock">
<ProgressBar android:id="@+id/update_notification_progressbar"
android:layout_width="260dip"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:layout_gravity="center_vertical"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
请高手看看问题出在哪谢谢了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货