首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

应用系统资源的引用总结以及收到短信后给一个notification提示

2012-09-01 
使用系统资源的引用总结以及收到短信后给一个notification提示1.代码使用android.R.id? xml引用 android:i

使用系统资源的引用总结以及收到短信后给一个notification提示

1.代码使用android.R.id? xml引用 android:id/tabhost? 颜色引用 android.R.color.transparent

调用动画 android.R.anim

2.

mNotificationManager = (NotificationManager) arg0.getSystemService(Context.NOTIFICATION_SERVICE);?
Uri uri = Uri.parse("content://sms/inbox");?
PendingIntent contentIntent = PendingIntent.getActivity(arg0, 0, new Intent(Intent.ACTION_VIEW, uri), Intent.FLAG_ACTIVITY_NEW_TASK);?
String tickerText = arg0.getString(R.string.newmsg, msgs[i].getMessageBody().toString());?
Notification notif = new Notification(R.drawable.icon, tickerText, System.currentTimeMillis());?
notif.setLatestEventInfo(arg0, msgs[i].getOriginatingAddress(), msgs[i].getMessageBody().toString(), contentIntent);?
notif.vibrate = new long[] { 100, 250, 100, 500 };?
mNotificationManager.notify(R.string.recv_msg_notif_id, notif);?

上述是不能实现的

应该如此修改

Intent notificationIntent = new Intent(Intent.ACTION_MAIN);?
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);?
notificationIntent.setType("vnd.android-dir/mms-sms");?

热点排行