List of usage examples for android.os Message obtain
public static Message obtain(Handler h, int what)
From source file:com.sabaibrowser.UI.java
protected final void showTitleBarForDuration(long duration) { showTitleBar();// w w w . j a v a 2 s .c o m Message msg = Message.obtain(mHandler, MSG_HIDE_TITLEBAR); mHandler.sendMessageDelayed(msg, duration); }
From source file:org.navitproject.navit.Navit.java
public void runOptionsItem(int id) { // Handle item selection switch (id) { case 1:/*from ww w . j a va 2 s. c om*/ // zoom in Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_ZOOM_IN.ordinal()) .sendToTarget(); // if we zoom, hide the bubble Log.e("Navit", "onOptionsItemSelected -> zoom in"); break; case 2: // zoom out Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_ZOOM_OUT.ordinal()) .sendToTarget(); // if we zoom, hide the bubble Log.e("Navit", "onOptionsItemSelected -> zoom out"); break; case 3: // map download menu Intent map_download_list_activity = new Intent(this, NavitDownloadSelectMapActivity.class); startActivityForResult(map_download_list_activity, Navit.NavitDownloaderSelectMap_id); break; case 5: // toggle the normal POI layers and labels (to avoid double POIs) Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal()); Bundle b = new Bundle(); b.putString("cmd", "toggle_layer(\"POI Symbols\");"); msg.setData(b); msg.sendToTarget(); msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal()); b = new Bundle(); b.putString("cmd", "toggle_layer(\"POI Labels\");"); msg.setData(b); msg.sendToTarget(); // toggle full POI icons on/off msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal()); b = new Bundle(); b.putString("cmd", "toggle_layer(\"Android-POI-Icons-full\");"); msg.setData(b); msg.sendToTarget(); break; case 6: // ok startup address search activity Intent search_intent = new Intent(this, NavitAddressSearchActivity.class); this.startActivityForResult(search_intent, NavitAddressSearch_id); break; case 7: /* Backup / Restore */ showDialog(NavitDialogs.DIALOG_BACKUP_RESTORE); break; case 10: setMapLocation(); break; case 99: // exit this.onStop(); this.exit(); break; } }
From source file:com.blestep.sportsbracelet.view.TimelineChartViewSleep.java
private void performComputeData() { clear();//from w w w.j a v a 2 s. co m // Process the data processData(); // Swap temporary refs mScroller.forceFinished(true); mState = STATE_IDLE; // Update the view and notify Message.obtain(mUiHandler, MSG_UPDATE_COMPUTED_DATA).sendToTarget(); // Update the graph view ViewCompat.postInvalidateOnAnimation(TimelineChartViewSleep.this); }
From source file:com.blestep.sportsbracelet.view.TimelineChartView.java
private void reloadCursorData() { Message.obtain(mBackgroundHandler, MSG_COMPUTE_DATA).sendToTarget(); }
From source file:com.shafiq.mytwittle.view.HomeActivity.java
void doUnbindService() { if (mIsBound) { // If we have received the service, and hence registered with it, // then now is the time to unregister. if (mService != null) { try { Message msg = Message.obtain(null, BackgroundService.MSG_UNREGISTER_CLIENT); msg.replyTo = mMessenger; mService.send(msg);/* w ww. j a va 2 s .c om*/ } catch (RemoteException e) { // There is nothing special we need to do if the service has // crashed. } } // Detach our existing connection. unbindService(mConnection); mIsBound = false; } }
From source file:com.blestep.sportsbracelet.view.TimelineChartView.java
private void performComputeData() { clear();//from w ww. j a v a 2s.c om // Process the data processData(); // Swap temporary refs mScroller.forceFinished(true); mState = STATE_IDLE; // Update the view and notify Message.obtain(mUiHandler, MSG_UPDATE_COMPUTED_DATA).sendToTarget(); // Update the graph view ViewCompat.postInvalidateOnAnimation(TimelineChartView.this); }
From source file:com.googlecode.networklog.NetworkLog.java
public static void updateNotificationText(String text) { if (isBound) { if (service != null) { try { Message msg = Message.obtain(null, NetworkLogService.MSG_UPDATE_NOTIFICATION); msg.obj = text;//from w ww . java2 s. com service.send(msg); } catch (RemoteException e) { /* do nothing */ Log.d("NetworkLog", "RemoteException updating notification", e); } } } }
From source file:ac.robinson.bettertogether.hotspot.HotspotManagerService.java
private void setWifiErrorTimeout() { Message message = Message.obtain(null, MSG_WIFI_CONNECTION_ERROR); mConnectionErrorHandler.sendMessageDelayed(message, mWifiConnectionTimeout); mWifiConnectionTimeout *= CONNECTION_DELAY_INCREMENT_MULTIPLIER; }
From source file:ac.robinson.bettertogether.hotspot.HotspotManagerService.java
private void setBluetoothErrorTimeout() { Message message = Message.obtain(null, MSG_BLUETOOTH_CONNECTION_ERROR); mConnectionErrorHandler.sendMessageDelayed(message, mBluetoothConnectionTimeout); mBluetoothConnectionTimeout *= CONNECTION_DELAY_INCREMENT_MULTIPLIER; }
From source file:org.navitproject.navit.Navit.java
void setDestination(float latitude, float longitude, String address) { Toast.makeText(getApplicationContext(), getString(R.string.address_search_set_destination) + "\n" + address, Toast.LENGTH_LONG).show(); //TRANS Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal()); Bundle b = new Bundle(); b.putFloat("lat", latitude); b.putFloat("lon", longitude); b.putString("q", address); msg.setData(b);//from w w w.j a v a2s . c om msg.sendToTarget(); }