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(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKN19b4aT1DHj8GUNi63hQtkKMMZBz85Is4BxJdhPcfrcbaDczl_1lhtztSIirdEAoNLN5F-aDcr7pBSdyFbupvipv2q7vmWWhcqhgsf8nr_nH0jBKyn4YGlBfuiV-BOWA56z7mdE4XXo/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; }