List of usage examples for android.os Message Message
public Message()
From source file:edu.missouri.bas.bluetooth.equivital.EquivitalRunnable.java
private void updateSummary(String motion, String bodyPosition, double beltSensorRate, double ecgDerivedRate, double impedanceRate, double ecgRate, double beltQuality, double ecgQuality, double impedanceQuality, double heartRateConfidence, double breathingRateConfidence, double GSR) { // TODO Auto-generated method stub String dataFromChestSensor = motion + "," + bodyPosition + "," + String.valueOf(beltSensorRate) + "," + String.valueOf(ecgDerivedRate) + "," + String.valueOf(impedanceRate) + "," + String.valueOf(ecgRate) + "," + String.valueOf(beltQuality) + "," + String.valueOf(ecgQuality) + "," + String.valueOf(impedanceQuality) + "," + String.valueOf(heartRateConfidence) + "," + String.valueOf(breathingRateConfidence) + "," + String.valueOf(GSR); Message msgData = new Message(); msgData.what = CHEST_SENSOR_DATA;//from w w w . jav a2 s.c o m Bundle dataBundle = new Bundle(); dataBundle.putString("DATA", dataFromChestSensor); msgData.obj = dataBundle; chestSensorDataHandler.sendMessage(msgData); }
From source file:com.xmobileapp.rockplayer.LastFmAlbumArtImporter.java
/********************************* * // ww w.j ava2s . co m * Constructor * @param context * *********************************/ public LastFmAlbumArtImporter(Context context) { this.context = context; try { /* * Check for Internet Connection (Through whichever interface) */ ConnectivityManager connManager = (ConnectivityManager) ((RockPlayer) context) .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = connManager.getActiveNetworkInfo(); /******* EMULATOR HACK - false condition needs to be removed *****/ //if (false && (netInfo == null || !netInfo.isConnected())){ if ((netInfo == null || netInfo.isConnected() == false)) { Bundle data = new Bundle(); data.putString("info", "No Internet Connection"); Message msg = new Message(); msg.setData(data); ((RockPlayer) context).getAlbumArtHandler.sendMessage(msg); return; } /* * Import Album Art from Last FM */ //getAlbumArt(); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.evecom.androidecssp.activity.taskresponse.TaskAndResponsesInfoActivity.java
@Override protected void onResume() { super.onResume(); if (ifloadresponselist) { ifloadresponselist = false;// w ww .j a v a2 s . c o m new Thread(new Runnable() { @Override public void run() { Message message = new Message(); HashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.put("taskId", taskInfo.get("id").toString()); try { resPonsesresutArray = connServerForResultPost( "jfs/ecssp/mobile/taskresponseCtr/getTaskResponseByTaskId", hashMap); } catch (ClientProtocolException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } catch (IOException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } if (resPonsesresutArray.length() > 0) { try { taskResponseInfos = getObjsInfo(resPonsesresutArray); if (null == taskResponseInfos) { message.what = MESSAGETYPE_02; } else { message.what = MESSAGETYPE_01; } } catch (JSONException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } } else { message.what = MESSAGETYPE_02; } Log.v("mars", resPonsesresutArray); responseListHandler.sendMessage(message); } }).start(); } }
From source file:com.firesoft.member.Activity.B2_SignupActivity.java
@Override public void OnMessageResponse(String url, JSONObject jo, AjaxStatus status) throws JSONException { if (url.endsWith(ApiInterface.USER_SIGNUP)) { usersignupResponse response = new usersignupResponse(); response.fromJson(jo);//from w w w . j a va2 s . c om if (response.succeed == 1) { Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); Message msg = new Message(); msg.what = MessageConstant.SIGN_UP_SUCCESS; EventBus.getDefault().post(msg); } else { if (response.error_code == APIErrorCode.NICKNAME_EXIST) { mNickname.requestFocus(); } } } }
From source file:com.insthub.O2OMobile.Activity.B2_SignupActivity.java
@Override public void OnMessageResponse(String url, JSONObject jo, AjaxStatus status) throws JSONException { if (url.endsWith(ApiInterface.USER_SIGNUP)) { usersignupResponse response = new usersignupResponse(); response.fromJson(jo);/*w w w.j av a 2s . c o m*/ if (response.succeed == 1) { Intent intent = new Intent(this, SlidingActivity.class); startActivity(intent); finish(); Message msg = new Message(); msg.what = MessageConstant.SIGN_UP_SUCCESS; EventBus.getDefault().post(msg); } else { if (response.error_code == APIErrorCode.NICKNAME_EXIST) { mNickname.requestFocus(); } } } }
From source file:com.sabdroidex.controllers.couchpotato.CouchPotatoController.java
/** * Add movie to couchpotato/* w w w . j a v a 2 s . c o m*/ * * @param messageHandler Handler * @param profile CouchPotato profile * @param idIMDb IMDB-ID * @param movieTitle Title of movie to add */ public static void addMovie(final Handler messageHandler, final String profile, final String idIMDb, final String movieTitle) { if (executingCommand || !Preferences.isSet(Preferences.COUCHPOTATO_URL)) { return; } Thread thread = new Thread() { @Override public void run() { try { String result = makeApiCall(MESSAGE.MOVIE_ADD.toString().toLowerCase(), "profile_id=" + profile, "identifier=" + idIMDb, "title=" + movieTitle); JSONObject jsonObject = new JSONObject(result); result = (String) jsonObject.get("added"); Message message = new Message(); message.setTarget(messageHandler); message.what = MESSAGE.MOVIE_ADD.hashCode(); message.obj = result; message.sendToTarget(); Thread.sleep(500); CouchPotatoController.refreshMovies(messageHandler, "active,done"); } catch (IOException e) { Log.w(TAG, " " + e.getLocalizedMessage()); sendUpdateMessageStatus(messageHandler, "Error"); } catch (Throwable e) { Log.w(TAG, " " + e.getLocalizedMessage()); } finally { executingCommand = false; sendUpdateMessageStatus(messageHandler, ""); } } }; executingCommand = true; thread.start(); }
From source file:com.mk4droid.IMC_Activities.Fragment_List.java
private void SetComplementaryButtons() { if (MyIssuesSW) MyIssuesSW = false;//from www . j ava 2s. com else MyIssuesSW = true; handlerBroadcastListRefresh.sendMessage(new Message()); savePreferences("MyIssuesSW", MyIssuesSW, "boolean"); if (MyIssuesSW) { // _-1 btListMyIss.setCompoundDrawablesWithIntrinsicBounds( resources.getDrawable(R.drawable.my_issues_icon_white32), null, null, null); btListMyIss.setBackgroundDrawable(resources.getDrawable(R.drawable.bt_custom_click_orange)); btListMyIss.setTextColor(Color.WHITE); btListMyIss.setClickable(false); // 0-_ btListAllIss.setCompoundDrawablesWithIntrinsicBounds( resources.getDrawable(R.drawable.all_issues_icon_gray32), null, null, null); btListAllIss.setBackgroundDrawable(resources.getDrawable(android.R.drawable.btn_default)); btListAllIss.setTextColor(Color.BLACK); btListAllIss.setClickable(true); } else { // _-0 btListMyIss.setCompoundDrawablesWithIntrinsicBounds( resources.getDrawable(R.drawable.my_issues_icon_gray32), null, null, null); btListMyIss.setBackgroundDrawable(resources.getDrawable(android.R.drawable.btn_default)); btListMyIss.setTextColor(Color.BLACK); btListMyIss.setClickable(true); // 1-_ btListAllIss.setCompoundDrawablesWithIntrinsicBounds( resources.getDrawable(R.drawable.all_issues_icon_white32), null, null, null); btListAllIss.setBackgroundDrawable(resources.getDrawable(R.drawable.bt_custom_click_orange)); btListAllIss.setTextColor(Color.WHITE); btListAllIss.setClickable(false); } }
From source file:com.htc.sample.pen.phonegap.PenPlugin.java
private void sendUpdate() { handler.sendMessage(new Message()); }
From source file:com.example.administrator.myapplication2._2_exercise._2_Status_heart.fragments.LeftFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout._2_status_heart, container, false); SharedPreferences myPrefs = getActivity().getSharedPreferences("alert", Context.MODE_PRIVATE); if ((myPrefs != null) && (myPrefs.contains("alert"))) { alert = myPrefs.getBoolean("alert", false); }//from ww w.j av a2s . co m mTextChat = (TextView) rootView.findViewById(R.id.text_chat); mTextChat.setMaxLines(1000); mTextChat.setVerticalScrollBarEnabled(true); mTextChat.setMovementMethod(new ScrollingMovementMethod()); //mEditChat = (EditText) rootView.findViewById(R.id.edit_chat); //mEditChat.setOnEditorActionListener(mWriteListener); mBtnSend = (Button) rootView.findViewById(R.id.button_send); mBtnSend.setOnClickListener(this); handler = new MyHandler(); progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar2); new Thread() { @Override public void run() { try { while (true) { sleep(1000); handler.sendMessage(new Message()); if (threadBool == false) { break; } } } catch (InterruptedException e) { e.printStackTrace(); } } }.start(); /*///////?//////////*/ heartRateList = new ArrayList<>(); tvTime = (TextView) rootView.findViewById(R.id.tvTime); ibPause = (ImageButton) rootView.findViewById(R.id.ibPause); ibStop = (ImageButton) rootView.findViewById(R.id.ibStop); ibPause.setOnClickListener(this); ibStop.setOnClickListener(this); m_display_run = new Runnable() { public void run() { // ? ? . tvTime.setText(m_display_string); } }; /*gps*/ // ? ? - mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); arrayPoints = new ArrayList<LatLng>(); arrayPoints_network = new ArrayList<LatLng>(); postJsonData1(); // ? startLocationService(); return rootView; }
From source file:com.samknows.measurement.MainService.java
public void publish(JSONObject jobj) { synchronized (sync) { if (mHandler != null && jobj != null) { Message msg = new Message(); msg.obj = jobj;/*from ww w.j a v a2 s. com*/ mHandler.sendMessage(msg); } } }