List of usage examples for android.os Message Message
public Message()
From source file:com.spoiledmilk.ibikecph.login.HTTPAccountHandler.java
public static Message performPutUser(UserData userData) { Message message = new Message(); JsonNode result = null;//from w ww . j av a 2 s. c o m JSONObject jsonPOST = new JSONObject(); JSONObject jsonUser = new JSONObject(); JSONObject jsonImagePath = new JSONObject(); try { jsonUser.put("name", userData.getName()); jsonUser.put("email", userData.getEmail()); jsonUser.put("password", userData.getPassword()); jsonUser.put("password_confirmation", userData.getPassword()); if (userData.getBase64Image() != null && !userData.getBase64Image().trim().equals("")) { jsonImagePath.put("filename", userData.getImageName()); jsonImagePath.put("original_filename", userData.getImageName()); jsonImagePath.put("file", userData.getBase64Image()); jsonUser.put("image_path", jsonImagePath); } jsonPOST.put("user", jsonUser); jsonPOST.put("id", userData.getId()); jsonPOST.put("auth_token", userData.getAuth_token()); result = HttpUtils.putToServer(Config.API_SERVER_REGISTER, jsonPOST); message = HttpUtils.JSONtoMessage(result); message.getData().putInt("type", PUT_USER); } catch (JSONException e) { LOG.e(e.getLocalizedMessage()); message.getData().putInt("type", ERROR); } return message; }
From source file:me.ziccard.secureit.fragment.AccelerometerFragment.java
public void onSensorChanged(SensorEvent event) { long curTime = System.currentTimeMillis(); // only allow one update every 100ms. if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { if ((curTime - lastUpdate) > 100) { long diffTime = (curTime - lastUpdate); lastUpdate = curTime;/*from w ww. ja v a 2 s . c o m*/ accel_values = event.values.clone(); if (alert && remainingAlertPeriod > 0) { remainingAlertPeriod = remainingAlertPeriod - 1; } else { accelerometerText.setVisibility(View.INVISIBLE); alert = false; } view.renderer.setPosition(-accel_values[0], accel_values[1], accel_values[2]); if (last_accel_values != null) { float speed = Math.abs(accel_values[0] + accel_values[1] + accel_values[2] - last_accel_values[0] + last_accel_values[1] + last_accel_values[2]) / diffTime * 10000; if (speed > SHAKE_THRESHOLD) { /* * Send Alert */ alert = true; remainingAlertPeriod = maxAlertPeriod; accelerometerText.setVisibility(View.VISIBLE); Message message = new Message(); message.what = UploadService.ACCELEROMETER_MESSAGE; try { if (serviceMessenger != null) { serviceMessenger.send(message); } } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } last_accel_values = accel_values.clone(); } } }
From source file:cn.sharesdk.analysis.server.ServiceHelper.java
public void sendUploadLogMsg() { Message msg = new Message(); msg.what = UPLOAD_LOG; handler.sendMessage(msg); }
From source file:cn.com.incito.driver.UI.detailDialog.ProvinceFragment.java
@Override public void onClick(View v) { int id = v.getId(); for (int i = 0; i < buttons.length; i++) { if (buttons[i] == id) { if (((PCCFragmentActivity) mContext).addStr(((Button) v).getText().toString(), PROVINCE, id)) { Message message = new Message(); message.arg1 = i;//index message.arg2 = id;// message.what = PROVINCE; mHandler.sendMessage(message); }// www. j a va 2s .c om } } }
From source file:com.watch.customer.ui.PersonShopActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_person_shop); findViewById(R.id.back).setOnClickListener(this); shoplist = (XListView) findViewById(R.id.personshopList); shoplist.setPullLoadEnable(false);// www . jav a 2 s . co m shoplist.setPullRefreshEnable(true); shoplist.setXListViewListener(this); mTypeDao = new TypeDao(this); shoplist.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub Intent mIntent = new Intent(PersonShopActivity.this, ShopDetailActivity.class); mIntent.putExtra("object", shoplistdata.get(position - 1)); startActivity(mIntent); } }); myHouseRun = new Runnable() { @Override public void run() { // TODO Auto-generated method stub String user_id = PreferenceUtil.getInstance(PersonShopActivity.this).getUid(); Log.e("hjq", HttpUtil.getURlStr(HttpUtil.URL_MYHOUSE, new BasicNameValuePair(JsonUtil.USER_ID, user_id))); String result = null; try { result = HttpUtil.post(HttpUtil.URL_MYHOUSE, new BasicNameValuePair(JsonUtil.USER_ID, user_id)); } catch (IOException e) { e.printStackTrace(); result = e.getMessage(); } Message msg = new Message(); msg.obj = result; mHandler.sendMessage(msg); } }; }
From source file:com.softminds.matrixcalculator.OperationFragments.AdjointFragment.java
public void RunToGetDeterminant(final int pos, final ProgressDialog px) { Runnable runnable = new Runnable() { @Override/*from ww w . j a va2 s . c o m*/ public void run() { Bundle bundle = SquareList.get(pos).getAdjoint(px).getDataBundled(); Message message = new Message(); message.setData(bundle); progress = px; myhandler.sendMessage(message); } }; Thread thread = new Thread(runnable); thread.start(); }
From source file:org.deviceconnect.android.deviceplugin.host.setting.HostSettingFragment.java
/** * Host PluginSearch???.//from ww w. j av a 2 s. c o m */ public void searchHost() { showProgressDialog(); try { mService.searchHost(); } catch (RemoteException e) { if (BuildConfig.DEBUG) { e.printStackTrace(); } } // Handler?? MyHandler handler = new MyHandler(); Message mMsg = new Message(); mMsg.what = HANDLER_ACTION_DISMISS; handler.sendMessageDelayed(mMsg, 8000); }
From source file:com.cleanwiz.applock.ui.activity.FeedbackActivity.java
private void initView() { mListView = (ListView) findViewById(R.id.fb_reply_list); sendBtn = (ImageView) findViewById(R.id.fb_send_btn); inputEdit = (EditText) findViewById(R.id.fb_send_content); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.fb_reply_refresh); mSwipeRefreshLayout.setColorSchemeResources(R.color.bg_red, R.color.text_password_wrong, R.color.lock_bg_blue);//from w w w . ja va 2 s . c o m sendBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String content = inputEdit.getText().toString(); inputEdit.getEditableText().clear(); if (!TextUtils.isEmpty(content)) { mComversation.addUserReply(content);//? mHandler.sendMessage(new Message()); sync(); } } }); // mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { sync(); } }); }
From source file:org.iotivity.base.examples.simpleserver.SimpleServer.java
public void logMessage(final String text) { runOnUiThread(new Runnable() { public void run() { final Message msg = new Message(); msg.obj = text;//from w w w . j a va 2s.c o m mEventsTextView.append("\n"); mEventsTextView.append(text); } }); Log.i(TAG, text); }
From source file:cn.sharesdk.analysis.server.ServiceHelper.java
public void saveAndSendLogMsg(Bundle bundle) { Message msg = new Message(); msg.what = SAVE_SEND_LOG; msg.setData(bundle); handler.sendMessage(msg); }