public void handleMessage(android.os.Message msg) { super.handleMessage(msg); if (msg.what == 200) { Toast.makeText(ShopDetailsCheckinActivity.this, "签到成功", 1).show(); finish(); } }
// 2.重写消息处理函数 public void handleMessage(Message msg) { switch (msg.what) { case 1: { // 更新View String state = msg.getData().getString("connect_state"); int viewId = msg.getData().getInt("viewId"); TextView textview; if (viewId == 0) { // ble连接状态 textview = connect_state; log("ble connecttion change"); } else { // 网络设备连接状态 textview = net_connect_state; log("net connecttion change"); } textview.setText(state); if (CONNECTED.equals(state)) { textview.setTextColor(0xff3FABCD); // green } else { textview.setTextColor(0xffff0000); // red } break; } } super.handleMessage(msg); }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); int remote_cmd = 0; switch (msg.what) { case 1: Toast.makeText(MainActivity.this, "成功连接到服务器", Toast.LENGTH_SHORT).show(); break; case 2: // 提取从服务器发过来的数据,然后发送给蓝牙设备 remote_cmd = msg.getData().getInt("REMOTE_CMD"); SendToBluetooth(mConnectThread, remote_cmd); break; case 3: ShowFailedConnectServerDialog(); // 如果连接服务器失败,则显示对话框 break; case 4: Toast.makeText(MainActivity.this, "蓝牙设备连接成功", Toast.LENGTH_SHORT).show(); tvinfo.setText(String.format("已经与蓝牙设备%s建立好连接", deviceName)); deviceList.clear(); break; default: break; } }
@Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_SPAM: { boolean fg = msg.arg1 != 0; Intent intent = new Intent(ActivityTestMain.this, SpamActivity.class); Bundle options = null; if (fg) { ActivityOptions opts = ActivityOptions.makeTaskLaunchBehind(); options = opts.toBundle(); } startActivity(intent, options); scheduleSpam(!fg); } break; case MSG_SPAM_ALARM: { long when = SystemClock.elapsedRealtime(); Intent intent = new Intent(ActivityTestMain.this, AlarmSpamReceiver.class); intent.setAction("com.example.SPAM_ALARM=" + when); PendingIntent pi = PendingIntent.getBroadcast(ActivityTestMain.this, 0, intent, 0); mAlarm.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME, when + (30 * 1000), pi); scheduleSpamAlarm(30 * 1000); } break; } super.handleMessage(msg); }
public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 1: { try { showalert(); } catch (Exception e) { e.printStackTrace(); // 显示提示框(没有网络,用户是否继续 ) 2010/7/2 陈晨 } break; } case 2: { mStartTask = new StartTask(); mStartTask.execute(); break; } case 3: { turnActivity(); break; } case 4: Toast.makeText(HomeActivity.this, "参数异常!", Toast.LENGTH_SHORT).show(); break; case 5: Toast.makeText(HomeActivity.this, "异常!", Toast.LENGTH_SHORT).show(); break; } }
@Override public void handleMessage(Message msg) { if (msg.what == 0) { Toast.makeText(PhotoActivity.this, "拍照完成!", Toast.LENGTH_LONG).show(); } super.handleMessage(msg); }
public void handleMessage(Message msg) { super.handleMessage(msg); if (loading != null) { loading.dismiss(); loading = null; } if (msg.what == 0 || msg.what == 3) { errorDialog("Wrong password (or internal error)"); } else if (msg.what == 2) { AlertDialog alert = new AlertDialog.Builder(CustomerActivity.this).create(); alert.setTitle("Email not knwon"); alert.setIcon(R.drawable.ic_launcher); alert.setButton( "Create Account", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { EditText e_email = (EditText) findViewById(R.id.editText1); RegisterActivity.email = e_email.getText().toString(); Intent i = new Intent(CustomerActivity.this, RegisterActivity.class); startActivity(i); } }); alert.setMessage("Do you want to register an account?"); alert.show(); } else { EditText e_email = (EditText) findViewById(R.id.editText1); APIHelper.auth_email = e_email.getText().toString(); Intent i = new Intent(CustomerActivity.this, BookingsActivity.class); startActivity(i); } }
public void handleMessage(Message msg) { switch (msg.what) { case 1: pb.setVisibility(4); isRun = false; image.setImageBitmap(bm); break; case 3: progressDialog.dismiss(); mThread = null; Toast.makeText(context, "Convert Success!!", Toast.LENGTH_SHORT).show(); File file = new File(root_Path2 + MyApplication.folder_path + ".pdf"); Intent mailIntent = new Intent(Intent.ACTION_SEND); mailIntent.putExtra(Intent.EXTRA_SUBJECT, "TinyScan"); mailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); if (file.getName().endsWith(".gz")) { mailIntent.setType("application/x-gzip"); // 如果是gz使用gzip的mime } else if (file.getName().endsWith(".txt")) { mailIntent.setType("text/plain"); // 纯文本则用text/plain的mime } else { mailIntent.setType("application/octet-stream"); // 其他的均使用流当做二进制数据来发送 } startActivity(Intent.createChooser(mailIntent, "Export")); break; default: break; } super.handleMessage(msg); }
@Override public void handleMessage(Message msg) { if (iWindowControl != null) if (msg.arg1 == 0) iWindowControl.reshow(); // // ((NaviStart3Activity)getFragmentManager().findFragmentById(R.id.mfragment1)).reshow(); else iWindowControl.dismiss(); // // ((NaviStart3Activity)getFragmentManager().findFragmentById(R.id.mfragment1)).dismiss(); int rl1_height = msg.what; params1.height = rl1_height; params2.height = height - rl1_height; rll1.setLayoutParams(params1); rll2.setLayoutParams(params2); if (params1.height == 0) { rll1.setVisibility(View.GONE); img0.setVisibility(View.VISIBLE); } if (params2.height == 0) { rll2.setVisibility(View.GONE); img1.setVisibility(View.VISIBLE); } if (params1.height == params2.height) { rll1.setVisibility(View.VISIBLE); rll2.setVisibility(View.VISIBLE); img0.setVisibility(View.GONE); img1.setVisibility(View.GONE); } super.handleMessage(msg); }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); // Log.i("tvinfo", msg.what + "-" + msg.obj); if (msg.what == 1) { progress.setVisibility(View.VISIBLE); title.setText("开始播放 ..."); } if (msg.what == 2) { title.setText("开始加载 ..."); } if (msg.what == 3) { title.setText("开始播放 ..."); play(prg); } if (msg.what == 4) { title.setText("加载失败 ..."); } if (msg.what == 9) { show("获取", "正在获取播放列表,请稍后..."); } if (msg.what == -100) { playmenu.setVisibility(View.GONE); } if (msg.what == 66) { if (player != null && player.isPlaying() && !isseek) { currtime.setText(Utils.longToString(player.getCurrentPosition())); playSeek.setProgress(player.getCurrentPosition() / 1000); } } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 2: homeBlogsAdapter = new BlogsAdapter(HomeBlogsView.this, blogs); lv_homeBlogs.setAdapter(homeBlogsAdapter); if (blogs.size() != 0) { ll_loadingView.setVisibility(View.GONE); } break; case REFRESH_DATA_FINISH: homeBlogsAdapter = new BlogsAdapter(HomeBlogsView.this, blogs); lv_homeBlogs.setAdapter(homeBlogsAdapter); if (blogs.size() != 0) { ll_loadingView.setVisibility(View.GONE); } if (homeBlogsAdapter != null) { homeBlogsAdapter.notifyDataSetChanged(); } lv_homeBlogs.onRefreshComplete(); // 下拉刷新完成 break; case LOAD_DATA_FINISH: Log.d("mo", "LOAD_DATA_FINISH"); if (homeBlogsAdapter != null) { blogs.addAll(dataBlogs); homeBlogsAdapter.notifyDataSetChanged(); } lv_homeBlogs.onLoadMoreComplete(); // 加载更多完成 break; default: break; } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case ENTER_HOME: // 进入主页面 Log.i(TAG, "进入主页面"); enterHome(); break; case SHOW_UPDATE_DIALOG: // 显示升级对话框 Log.i(TAG, "显示升级对话框"); showUpdateDialog(); break; case URL_ERROR: // URL错误 Log.i(TAG, "URL错误"); Toast.makeText(SplashActivity.this, "URL错误", Toast.LENGTH_SHORT).show(); enterHome(); break; case NETWORK_ERROR: // 网络错误 Log.i(TAG, "网络异常"); Toast.makeText(SplashActivity.this, "网络异常", Toast.LENGTH_SHORT).show(); enterHome(); break; case JSON_ERROR: // JSON解析出错 Log.i(TAG, "SON解析出错"); Toast.makeText(getApplicationContext(), "SON解析出错", Toast.LENGTH_SHORT).show(); enterHome(); break; default: break; } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); stopProgressDialog2(); if (msg.obj != null) { Dialog(describe); } }
public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case SENSOR_SHAKE: Toast.makeText(MainActivity.this, "检测到摇晃,执行操作!", Toast.LENGTH_SHORT).show(); break; } }
@SuppressWarnings("unchecked") @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); switch (msg.what) { case IS_REQUSTING: mDialog = Utils.createLoadingDialog(mContext, "正在请求设备周围WiFi列表..."); mDialog.show(); break; case REQUST_TIMEOUT: if (mDialog != null) mDialog.dismiss(); if (handler.hasMessages(REQUST_TIMEOUT)) { handler.removeMessages(REQUST_TIMEOUT); } Toast.makeText(mContext, "请求WiFi列表失败,请重试! ", Toast.LENGTH_SHORT).show(); break; case R.id.requst_wifi_list_id: if (handler.hasMessages(REQUST_TIMEOUT)) { handler.removeMessages(REQUST_TIMEOUT); if (mDialog != null) mDialog.dismiss(); int resultCode = msg.arg1; if (resultCode == 0) { showWiFiListDialog((ArrayList<HashMap<String, Object>>) msg.obj); } else { Toast.makeText(mContext, "设备附近暂时没有WiFi信号! ", Toast.LENGTH_SHORT).show(); } } else { handler.removeMessages(R.id.requst_wifi_list_id); } break; case IS_SETTING: mDialog = Utils.createLoadingDialog(mContext, "正在配置设备WiFi网络..."); mDialog.show(); break; case SET_TIMEOUT: if (mDialog != null) mDialog.dismiss(); if (handler.hasMessages(SET_TIMEOUT)) { handler.removeMessages(SET_TIMEOUT); } Toast.makeText(mContext, "配置设备WiFi网络超时,请重试! ", Toast.LENGTH_SHORT).show(); break; case R.id.set_term_wifi_id: if (handler.hasMessages(SET_TIMEOUT)) { handler.removeMessages(SET_TIMEOUT); if (mDialog != null) mDialog.dismiss(); int resultCode = msg.arg1; if (resultCode == 1) { Toast.makeText(mContext, "配置设备WiFi网络成功! ", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(mContext, "配置设备WiFi网络失败,请重试! ", Toast.LENGTH_SHORT).show(); } } else { handler.removeMessages(R.id.set_term_wifi_id); } break; } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 0: CuzyTBKEntity entity = (CuzyTBKEntity) msg.obj; if (entity.getCode() == 0) { hasNext = true; if (entity.getData().size() == 0) { hasNext = false; } if (!isLoadMore && cuzys.size() > 0) { cuzys.clear(); cuzyCopys.clear(); } cuzys = entity.getData(); if (cuzys.size() == 0) { if (dialog.isShowing()) { dialog.dismiss(); } stopStatus(); return; } cuzyCopys.addAll(cuzys); if (hasNext && isLoadMore) { initListView(cuzyCopys); } else { initListView(cuzys); } } else { hasNext = false; } if (dialog.isShowing()) { dialog.dismiss(); } stopStatus(); break; } }
public void handleMessage(Message msg) { switch (msg.what) { case MainActivity.GUIUPDATEIDENTIFIER: Bundle b = msg.getData(); updateControls(); break; } super.handleMessage(msg); }
public void handleMessage(Message msg) { switch (msg.what) { case 100: adapter.notifyDataSetChanged(); mRestoreList.onRefreshFinish(); break; } super.handleMessage(msg); }
// 当有消息发送出来的时候就执行Handler的这个方法 @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 1: getGameData(); break; } }
// 当有消息发送出来的时候就执行Handler的这个方法 @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 1: update(); break; } }
@Override public void handleMessage(Message msg) { switch (msg.what) { case 1: // getPushMessage(); break; } super.handleMessage(msg); }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); ColorTrackView colorTrackView = (ColorTrackView) findViewById(R.id.colorTrackView); ObjectAnimator oa = ObjectAnimator.ofFloat(colorTrackView, "refresh", 100, 0); oa.setDuration(2000); oa.start(); }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); PacketBuffer packetBuffer = (PacketBuffer) msg.obj; if (packetBuffer != null) { byte[] data = packetBuffer.getData(); tv.setText(Arrays.toString(data)); } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); stopProgressDialog(); Music1.setRESULTS(result); Intent intent = new Intent(MainActivity.this, VidioActivity.class); startActivity(intent); // text.setText(result); }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == 1) { updateChart(msg.arg1); } else { generateStackedData(msg.arg1, msg.arg2); } }
public void handleMessage(Message msg) { switch (msg.what) { case TEXTSET: pagefactory.changBackGround(msg.arg1); pagefactory.onDraw(mCurPageCanvas); mPageWidget.postInvalidate(); break; case OPENMARK: try { mCursor = db.select(); } catch (Exception e) { e.printStackTrace(); } if (mCursor.getCount() > 0) { mCursor.moveToPosition(mCursor.getCount() - 1); String pos = mCursor.getString(2); mCursor.getString(1); pagefactory.setBeginPos(Integer.valueOf(pos)); try { pagefactory.prePage(); } catch (IOException e) { e.printStackTrace(); } pagefactory.onDraw(mNextPageCanvas); mPageWidget.setBitmaps(mCurPageBitmap, mNextPageBitmap); mPageWidget.invalidate(); db.close(); } break; case SAVEMARK: try { db.update(book.id, book.bookname, String.valueOf(msg.arg2)); db.updateSetup(setup.id, String.valueOf(msg.arg1), "0", "0"); // mCursor = db.select(); } catch (Exception e) { e.printStackTrace(); } // System.out.println(mCursor.getCount()); // if (mCursor.getCount() > 0) { // mCursor.moveToPosition(mCursor.getCount()-1); // db.update(book.id, book.bookname, // String.valueOf(msg.arg2),String.valueOf(msg.arg1)); // } else { // db.insert("", String.valueOf(msg.arg2),String.valueOf(msg.arg1)); // } db.close(); break; default: break; } super.handleMessage(msg); }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); if (msg.what == 2) { ToastUtils.showToast(PhotoSetActivity.this, "上传成功"); } finish(); }
@Override public void handleMessage(Message msg) { switch (msg.what) { case BUMP_MSG: mCallbackText.setText("Received from service: " + msg.arg1); break; default: super.handleMessage(msg); } }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); BadgeView badgeView = (BadgeView) msg.obj; badgeView.setText(msg.what + ""); badgeView.setBackgroundResource(R.drawable.badge_ifaux); badgeView.setTextSize(16); badgeView.toggle(true); }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 1: handler.post(weiboDelRunnable); break; default: break; } }