@Override public void handleMessage(Message msg) { switch (msg.what) { case GUI_START_NOTIFIER: if (!Thread.currentThread().isInterrupted()) { /*设置为当前进度*/ mProgressBar.setProgress(progress); /*将显示信息显示在屏幕上*/ progress_detail_info.setText( getResources().getText(R.string.str_progress_loading) + "(" + progress + "%)\n" + "Progress:" + Integer.toString(mProgressBar.getProgress()) + "\n" + "Indeterminate:" + Boolean.toString(mProgressBar.isIndeterminate())); mHandler.postDelayed(progressThread, 1000); } break; case GUI_STOP_NOTIFIER: /*隐藏进度条*/ mProgressBar.setVisibility(View.GONE); /*显示加载成功*/ progress_detail_info.setText(R.string.str_progress_done); /*停止线程*/ Thread.currentThread().interrupt(); break; } super.handleMessage(msg); }
@Override public void handleMessage(Message msg) { switch (msg.what) { case MY_MSG: double amp = (double) msg.obj; if ((amp > mThreshold) && !mCalib) { mHitCount++; if (mHitCount > mHitMax) { // Intentos superados showMessage("Limite de ruido superado reiteradamente"); mp.start(); stopAlarm(); } } decibelsTx.setText("Nivel de Ruido: " + msg.obj + "dB"); double barValue = (100 * (double) msg.obj) / (120); barDB.setProgress((int) barValue); break; case MAXOVER_MSG: mMax = false; break; case ERROR_MSG: Toast.makeText(mContext, "Error " + msg.obj, Toast.LENGTH_LONG).show(); break; default: super.handleMessage(msg); break; } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); int lines = msg.what; textView.setMaxLines(lines); textView.postInvalidate(); }
@Override public void handleMessage(Message msg) { if (msg.what == 1) { iv.setImageBitmap(BitmapFactory.decodeFile(msg.obj.toString())); } super.handleMessage(msg); }
@Override public void handleMessage(Message msg) { switch (msg.what) { case STEPS_MSG: mStepValue = (int) msg.arg1; mStepValueView.setText("" + mStepValue); break; case PACE_MSG: mPaceValue = msg.arg1; if (mPaceValue <= 0) { mPaceValueView.setText("0"); } else { mPaceValueView.setText("" + (int) mPaceValue); } break; case DISTANCE_MSG: mDistanceValue = ((int) msg.arg1) / 1000f; if (mDistanceValue <= 0) { mDistanceValueView.setText("0"); } else { mDistanceValueView.setText(("" + (mDistanceValue + 0.000001f)).substring(0, 5)); } break; case SPEED_MSG: mSpeedValue = ((int) msg.arg1) / 1000f; if (mSpeedValue <= 0) { mSpeedValueView.setText("0"); } else { mSpeedValueView.setText(("" + (mSpeedValue + 0.000001f)).substring(0, 4)); } break; case CALORIES_MSG: mCaloriesValue = msg.arg1; if (mCaloriesValue <= 0) { mCaloriesValueView.setText("0"); } else { mCaloriesValueView.setText("" + (int) mCaloriesValue); } break; case PedomenterMainActivity.TIME_MSG /*6*/: PedomenterMainActivity.this.mTimeValue = ((Long) msg.obj).longValue(); PedomenterMainActivity.this.mTimeValueView.setText( PedometerUtils.formatTime( PedomenterMainActivity.this.mTimeValue + PedomenterMainActivity.this .getSharedPreferences("state", 0) .getLong("time", 0))); default: super.handleMessage(msg); } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == 1) { deleteAlarm.setVisibility(View.VISIBLE); State = 0; // 删除闹钟界面 } else if (msg.what == RefreshTime.UPDATE_TIME) { RefreshTime.runFlag = false; Timetv.setText(msg.obj.toString()); String date = sDatedf.format(new java.util.Date()); Date.setText(date); Weekofday.setText("星期" + getWeekOfDay()); RefreshTime.runFlag = true; } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == 1) { mViewTempClear.setText("清除缓存\n正在删除缓存文件.."); DataCleanManager.clearAllCache(getApplicationContext()); String strTempSize = null; try { strTempSize = DataCleanManager.getTotalCacheSize(getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } mViewTempClear.setText("清除缓存\n缓存大小为:" + strTempSize); } else if (msg.what == 2) { // int nMar = 0; // int nMin = 0; // GetVersion(SettingInfo.NETWORK_URL_VERSION, nMar, nMin); // String strReplyInfo = // "检查更新\n当前版本为"+SettingInfo.VERSION_MARJOR+"."+SettingInfo.VERSION_MINJOR+",已是最新版本"; // mViewCheckUpdate.setText(strReplyInfo); } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); adapter.notifyDataSetChanged(); refleshListView.completeReflesh(); }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); textView.setText("state:" + msg.getData().getString("state")); }
@Override public void handleMessage(Message msg) { dataList = new ArrayList<Map<String, Object>>(); super.handleMessage(msg); String code = (String) msg.obj; if (code != null) { switch (code) { case "200": // List<String> datas = json.getData("ChID", // person.getJSONArray("data")); // List<String> status = json.getData("Status", // person.getJSONArray("data")); List<String> datas = heballtCollectConnect.getConnectData("ChID"); List<String> status = heballtCollectConnect.getConnectData("Status"); int i; for (i = 0; i < datas.size() - 1; i++) { Map<String, Object> map = new HashMap<String, Object>(); map.put("ActivityFictionContent", "第" + datas.get(i) + "章"); dataList.add(map); } switch (status.get(i)) { case "2": isNew = true; newChapter = datas.size() - 1; chap = datas.get(i); Map<String, Object> map = new HashMap<String, Object>(); map.put("ActivityFictionContent", "第" + chap + "章(New!)"); dataList.add(map); break; default: Map<String, Object> map2 = new HashMap<String, Object>(); map2.put("ActivityFictionContent", "第" + datas.get(i) + "章"); dataList.add(map2); break; } simple_adapter = new SimpleAdapter( ActivityFictionChapter.this, dataList, R.layout.item, new String[] {"ActivityFictionContent"}, new int[] {R.id.id_txt_item}); final List<String> numb = heballtCollectConnect.getConnectData("CtID"); listView.setAdapter(simple_adapter); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Intent intent; if (arg2 != newChapter) { intent = new Intent(ActivityFictionChapter.this, ActivityFictionContent.class); intent.putExtra("CtID", numb.get(arg2)); } else { intent = new Intent( ActivityFictionChapter.this, ActivityFictionNewChapter.class); intent.putExtra("FID", one); intent.putExtra("ChID", chap); } startActivity(intent); } }); break; default: break; } } else { new AlertDialog.Builder(ActivityFictionChapter.this) .setTitle("提示信息") .setMessage("无法连接至服务器") .setPositiveButton( "确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {} }) .show(); } }