2009年2月4日 星期三

ProgressDialog無法在Activity建立過程中使用

居然會因為底層的問題沒辦法在Activity的onCreate() onStart()之類的途中使用 orz
就算要插一個Activity在中間也有資料傳輸的問題,直接改layout更是一整個suck
不是我要講,這還真的滿鳥的…………

所以剩下的辦法就是改用notification:

Context ctx = getApplicationContext();
final NotificationManager nm = (NotificationManager) getSystemService("notification");
Notification n = new Notification(R.drawable.icon,
getString(R.string.loading_message), System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0,
new Intent(ctx, FileBrowserActivity.class), 0);
n.flags = Notification.FLAG_NO_CLEAR;
n.setLatestEventInfo(ctx, getString(R.string.app_name),
getString(R.string.loading_message), contentIntent);
nm.notify(LOADING_NOTIFICATION, n);

沒有留言:

CODE { display: block; /* fixes a strange ie margin bug */ font-family: Courier New; font-size: 8pt; overflow:auto; background: #f0f0f0 url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y; border: 1px solid #ccc; padding: 10px 10px 10px 21px; max-height:200px; height:200px; // for IE6 line-height: 1.2em; } #quote { display: block; /* fixes a strange ie margin bug */ font-family: Verdana; font-size: 10pt; overflow:auto; background: #f7f7f7 url(http://lh5.ggpht.com/_z-VThISftkI/SXUlpyfw9ZI/AAAAAAAABYY/e3GUx9_Z4TE/s288/quote-l.gif) left top no-repeat; border: 4px dotted #ccc; padding: 15px 15px 15px 31px; /*up right bottom left*/ max-height:300px; line-height: 1.2em; }