使用NotificationCompat,mErrorCount = adapter.getCount(),将mErrorCount打印出来,
adapter = new TideListViewAdapter(TideMapActivity.this, list);
lvTide.setAdapter(adapter);
lvTide.setOnItemClickListener(tideListOnItemClick);
lvTide.setOnItemLongClickListener(tideListOnItemLongClick);
lvTide.setOnRefreshListener(tideRefreshListener);
mErrorCount = adapter.getCount();
///Intent resultIntent = new Intent(this, TideMapActivity.class);
// resultIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
//PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
notifyBuilder = new NotificationCompat.Builder(this)
/*设置large icon*/
.setLargeIcon(bitmap)
/*设置small icon*/
.setSmallIcon(R.drawable.ic_launcher)
/*设置title*/
.setContentTitle("出现异常的监测点个数为")
/*设置详细文本*/
.setContentText(String.valueOf(mErrorCount)+"个")
/*设置发出通知的时间为发出通知时的系统时间*/
.setWhen(System.currentTimeMillis())
/*设置发出通知时在status bar进行提醒*/
.setTicker("有故障监测点")
正常运行,mErrorCount一直显示为0,分步调试才能正确显示,什么原因?