List of usage examples for android.os Message Message
public Message()
From source file:goo.TeaTimer.TimerActivity.java
/** Called whenever the internal timer is updated */ protected void timerTic() { mTime -= TIMER_TIC;/*from www. j a v a2 s . c o m*/ if (mHandler != null) { Message msg = new Message(); msg.arg1 = mTime; mHandler.sendMessage(msg); } }
From source file:com.BibleQuote.BibleQuoteAndroid.ui.ReaderActivity.java
public void viewChapterNav() { if (chapterNavHandler.hasMessages(R.id.view_chapter_nav)) { chapterNavHandler.removeMessages(R.id.view_chapter_nav); }/*w w w.j a v a 2 s . c o m*/ if (vWeb.getMode() != ReaderWebView.Mode.Study) { btnChapterNav.setVisibility(View.GONE); } else { btnChapterNav.setVisibility(View.VISIBLE); if (!vWeb.isScrollToBottom()) { Message msg = new Message(); msg.what = R.id.view_chapter_nav; chapterNavHandler.sendMessageDelayed(msg, VIEW_CHAPTER_NAV_LENGHT); } } }
From source file:com.xdyou.sanguo.GameSanGuo.java
public static void appsFlyerLoginTracker(String userId) { Message appFlyer = new Message(); appFlyer.what = APP_FLYERS_LOGIN;/*from ww w.ja va 2 s . c om*/ appFlyer.obj = userId; handler.sendMessage(appFlyer); }
From source file:com.app.jdy.ui.RegirsterActivity.java
/** * //from w ww.j a va2s .c o m * @author zhoufeng * @createtime 2015-1-13 ?1:35:16 * @Decription ??? * */ public void getCheckCode() { get_regirster_code.setClickable(false); get_regirster_code.setBackgroundResource(R.drawable.regirster_code_false); get_regirster_code.setTextColor(getResources().getColor(R.color.text_hint)); String username = new_username.getText().toString().trim(); phone = new ArrayList<NameValuePair>(); phone.add(new BasicNameValuePair("phone", username)); Log.i("aaaa", "phone===" + username); /** * ???? */ Thread code_thread = new Thread(new Runnable() { @Override public void run() { dataJson = HttpUtils.request(phone, URLs.CHECH_PHONE); Message msg = new Message(); if (HttpUtils.isNetworkConnected(mContext)) { msg.what = 1; } else { msg.what = 2; } handler.sendMessage(msg); } }); code_thread.start(); }
From source file:com.studio.arm.wink.FaceTrackerActivity.java
private void takePicture() { mCameraSource.takePicture(null, new CameraSource.PictureCallback() { File picture;/* w w w . j ava 2 s . c o m*/ @Override public void onPictureTaken(byte[] bytes) { try { Thread.currentThread().sleep((long) (sharedPref.getFloat(FILENAME, 1f) * 1000)); mPreview.stop(); picture = null; try { picture = FaceFile.savePicture(bytes, "jpg"); } catch (IOException e) { e.printStackTrace(); return; } new AlertDialog.Builder(FaceTrackerActivity.this).setTitle("Share").setMessage("Share to") .setPositiveButton("Filters", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent shareIntent = new Intent().setPackage("com.vk.snapster"); shareIntent.setType("image/jpeg"); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(picture)); startActivity(Intent.createChooser(shareIntent, "")); } }).setNegativeButton("Upload", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { new ProgressTask().execute(picture); createCameraSource(flag ? CameraSource.CAMERA_FACING_BACK : CameraSource.CAMERA_FACING_FRONT); startCameraSource(); Message msg = new Message(); msg.obj = FACE_NONE; handler.sendMessage(msg); } }).setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { createCameraSource(flag ? CameraSource.CAMERA_FACING_BACK : CameraSource.CAMERA_FACING_FRONT); startCameraSource(); Message msg = new Message(); msg.obj = FACE_NONE; handler.sendMessage(msg); } }).setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { createCameraSource(flag ? CameraSource.CAMERA_FACING_BACK : CameraSource.CAMERA_FACING_FRONT); startCameraSource(); Message msg = new Message(); msg.obj = FACE_NONE; handler.sendMessage(msg); } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } catch (InterruptedException e) { } catch (RuntimeException r) { Log.d("Errorrrrrrrr", "RuntimeError"); } } }); }
From source file:com.sabdroidex.controllers.couchpotato.CouchPotatoController.java
/** * Search for a movie based on title//from w ww . ja v a2s . c o m * * @param messageHandler Handler * @param searchTitle Movie title to search for */ public static void searchMovie(final Handler messageHandler, final String searchTitle) { if (!Preferences.isSet(Preferences.COUCHPOTATO_URL)) { return; } Thread thread = new Thread() { @Override public void run() { try { String result = makeApiCall(MESSAGE.MOVIE_SEARCH.toString().toLowerCase(), "q=" + searchTitle); JSONObject jsonObject = new JSONObject(result); MovieSearch movieList = null; if (!jsonObject.isNull("message") && !"".equals(jsonObject.getString("message"))) { sendUpdateMessageStatus(messageHandler, "CouchPotato : " + jsonObject.getString("message")); } else { SimpleJSONMarshaller jsonMarshaller = new SimpleJSONMarshaller(MovieSearch.class); movieList = (MovieSearch) jsonMarshaller.unMarshal(jsonObject); } Message message = new Message(); message.setTarget(messageHandler); message.what = MESSAGE.MOVIE_SEARCH.hashCode(); message.obj = movieList; message.sendToTarget(); } catch (IOException e) { Log.w(TAG, " " + e.getLocalizedMessage()); } catch (Throwable e) { Log.w(TAG, " " + e.getLocalizedMessage()); } finally { executingCommand = false; } } }; executingRefreshMovies = true; executingCommand = true; thread.start(); }
From source file:com.watch.customer.ui.ShopListActivity.java
private void SearchBySec() { Log.e("hjq", "SearchBySec"); final String citystr = citytext.getText().toString().trim(); Runnable listRun = new Runnable() { @Override/*from w w w . ja va 2s .c om*/ public void run() { // TODO Auto-generated method stub ArrayList<BasicNameValuePair> mPair = new ArrayList<BasicNameValuePair>(); if (selectPos[0] != 0) { String para1 = secArr1.get(selectPos[0]); mPair.add(new BasicNameValuePair(JsonUtil.DISCOUNT, para1)); } if (selectPos[1] != 0) { String para2 = mTypeDao.queryByName(secArr2.get(selectPos[1])).getId(); mPair.add(new BasicNameValuePair(JsonUtil.ID, para2)); } if (selectPos[2] != 0) { String para3 = selectPos[2] + ""; mPair.add(new BasicNameValuePair(JsonUtil.SERVICEID, para3)); } if (PreferenceUtil.getInstance(ShopListActivity.this).getString(PreferenceUtil.CITYID, "0") .equals("0")) { mPair.add(new BasicNameValuePair(JsonUtil.CITY, "58")); } else { mPair.add(new BasicNameValuePair(JsonUtil.CITY, PreferenceUtil .getInstance(ShopListActivity.this).getString(PreferenceUtil.CITYID, "0"))); } String lat = PreferenceUtil.getInstance(ShopListActivity.this).getString(PreferenceUtil.LAT, ""); String lon = PreferenceUtil.getInstance(ShopListActivity.this).getString(PreferenceUtil.LON, ""); if (!lat.equals("") && !lon.equals("")) { mPair.add(new BasicNameValuePair(JsonUtil.LAT, lat)); mPair.add(new BasicNameValuePair(JsonUtil.LONG, lon)); } mPair.add(new BasicNameValuePair(JsonUtil.PAGE, String.valueOf(pagerindex))); BasicNameValuePair[] pairs = new BasicNameValuePair[mPair.size()]; for (int i = 0; i < pairs.length; i++) { pairs[i] = mPair.get(i); } Log.e("hjq", HttpUtil.getURlStr(HttpUtil.URL_FINDSTOREBYALL, pairs)); String result = null; try { result = HttpUtil.post(HttpUtil.URL_FINDSTOREBYALL, pairs); } catch (IOException e) { e.printStackTrace(); result = e.getMessage(); } Message msg = new Message(); msg.what = shoplist_what; msg.obj = result; mHandler.sendMessage(msg); } }; ThreadPoolManager.getInstance().addTask(listRun); }
From source file:com.xpg.gokit.activity.GokitControlActivity.java
public boolean onOptionsItemSelected(MenuItem menu) { super.onOptionsItemSelected(menu); switch (menu.getItemId()) { // /*from w w w.j a v a 2 s .c om*/ case R.id.action_disconnect: mCenter.cDisconnect(xpgWifiDevice); xpgWifiDevice = null; finish(); break; // case R.id.action_unbind: String uid = setmanager.getUid(); String token = setmanager.getToken(); String hideuid = setmanager.getHideUid(); String hidetoken = setmanager.getHideToken(); if (!uid.equals("") && !token.equals("")) { mCenter.cUnbindDevice(xpgWifiDevice, uid, token); } else if (!hideuid.equals("") && !hidetoken.equals("")) { mCenter.cUnbindDevice(xpgWifiDevice, hideuid, hidetoken); } else { Toast.makeText(this, "?", Toast.LENGTH_SHORT).show(); } break; // ?? case R.id.action_device_status: try { mCenter.cGetStatus(xpgWifiDevice); } catch (Exception e) { e.printStackTrace(); } break; // ?? case R.id.action_device_hardwareinfo: if (xpgWifiDevice.isLAN()) { xpgWifiDevice.getHardwareInfo(); } else { Message msg = new Message(); msg.what = HARDWARE; msg.obj = "????"; handler.sendMessage(msg); } break; default: break; } return true; }
From source file:net.evecom.android.log.DailyLogLookActivity.java
/** * // ww w . j av a2s. c o m */ private void formSubmit1() { new Thread(new Runnable() { @Override public void run() { try { Message msg_listData = new Message(); String a = HttpUtil.BASE_URL + "teventAndroid/deleteDailyLogAndroid"; String b = "sysid=" + sysid; try { sss = connServerForResultPost(a, b); } catch (Exception e) { msg_listData.what = MESSAGETYPE_02; } if (sss == null || "".equals(sss) || sss.contains("failure")) { msg_listData.what = MESSAGETYPE_02; } else { msg_listData.what = MESSAGETYPE_01; } handler1.sendMessage(msg_listData); } catch (Exception e) { if (null != e) { e.printStackTrace(); } } } }).start(); }
From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java
public void goodsxiajia(final String id) { new Thread() { Message msg = new Message(); @Override/* ww w .ja va 2 s . c o m*/ public void run() { String data = "&id=" + id; Log.e("data=", data); String result_data = NetUtil.getResponse(WebAddress.GOODSXIAJIA, data); Log.e("result_data = ", result_data); try { JSONObject jsonObject = new JSONObject(result_data); msg.what = CommunalInterfaces.GOODSXIAJIA; msg.obj = jsonObject; } catch (JSONException e) { e.printStackTrace(); } finally { handler.sendMessage(msg); } } }.start(); }