Java Code Examples for android.content.Intent#getDoubleExtra()
The following examples show how to use
android.content.Intent#getDoubleExtra() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShowLocationActivity.java From Pix-Art-Messenger with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_locaction); setTitle(getString(R.string.show_location)); setSupportActionBar(findViewById(R.id.toolbar)); configureActionBar(getSupportActionBar()); showLocation(null, ""); Intent intent = getIntent(); this.mLocationName = intent != null ? intent.getStringExtra("name") : null; if (intent != null && intent.hasExtra("longitude") && intent.hasExtra("latitude")) { double longitude = intent.getDoubleExtra("longitude", 0); double latitude = intent.getDoubleExtra("latitude", 0); this.location = new Location(""); this.location.setLatitude(latitude); this.location.setLongitude(longitude); Log.d(Config.LOGTAG, "Location: lat: " + latitude + " long: " + longitude); markAndCenterOnLocation(this.location); fab = findViewById(R.id.fab); fab.setOnClickListener(v -> { navigate(this.location); }); } }
Example 2
Source File: LibreReceiver.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static Libre2RawValue processIntent(Intent intent) { Bundle sas = intent.getBundleExtra("sas"); try { if (sas != null) saveSensorStartTime(sas.getBundle("currentSensor"), intent.getBundleExtra("bleManager").getString("sensorSerial")); } catch (NullPointerException e) { Log.e(TAG,"Null pointer exception in processIntent: " + e); } if (!intent.hasExtra("glucose") || !intent.hasExtra("timestamp") || !intent.hasExtra("bleManager")) { Log.e(TAG,"Received faulty intent from LibreLink."); return null; } double glucose = intent.getDoubleExtra("glucose", 0); long timestamp = intent.getLongExtra("timestamp", 0); last_reading = timestamp; String serial = intent.getBundleExtra("bleManager").getString("sensorSerial"); if (serial == null) { Log.e(TAG,"Received faulty intent from LibreLink."); return null; } Libre2RawValue rawValue = new Libre2RawValue(); rawValue.timestamp = timestamp; rawValue.glucose = glucose; rawValue.serial = serial; return rawValue; }
Example 3
Source File: MainActivity.java From LocationPicker with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ADDRESS_PICKER_REQUEST) { try { if (data != null && data.getStringExtra(MapUtility.ADDRESS) != null) { String address = data.getStringExtra(MapUtility.ADDRESS); double currentLatitude = data.getDoubleExtra(MapUtility.LATITUDE, 0.0); double currentLongitude = data.getDoubleExtra(MapUtility.LONGITUDE, 0.0); txtAddress.setText("Address: "+address); txtLatLong.setText("Lat:"+currentLatitude+" Long:"+currentLongitude); } } catch (Exception ex) { ex.printStackTrace(); } } }
Example 4
Source File: ForecastService.java From PressureNet with GNU General Public License v3.0 | 5 votes |
private void downloadTemperatures(Intent intent) { latitudeParam = intent.getDoubleExtra("latitude", 0.0); longitudeParam = intent.getDoubleExtra("longitude", 0.0); deltaParam = intent.getDoubleExtra("delta", 0.0); if(latitudeParam != 0.0) { log("forecast service downloading temperature data lat " + latitudeParam + ", lon " + longitudeParam + ", delta " + deltaParam); (new TemperatureDownloader()).execute(""); } else { log("params are null, app not downloading temperature forecasts"); } }
Example 5
Source File: EaseChatFragment.java From Social with Apache License 2.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { if (requestCode == REQUEST_CODE_CAMERA) { // 发送照片 if (cameraFile != null && cameraFile.exists()) sendImageMessage(cameraFile.getAbsolutePath()); } else if (requestCode == REQUEST_CODE_LOCAL) { // 发送本地图片 if (data != null) { Uri selectedImage = data.getData(); if (selectedImage != null) { sendPicByUri(selectedImage); } } } else if (requestCode == REQUEST_CODE_MAP) { // 地图 double latitude = data.getDoubleExtra("latitude", 0); double longitude = data.getDoubleExtra("longitude", 0); String locationAddress = data.getStringExtra("address"); if (locationAddress != null && !locationAddress.equals("")) { sendLocationMessage(latitude, longitude, locationAddress); } else { Toast.makeText(getActivity(), R.string.unable_to_get_loaction, 0).show(); } } } }
Example 6
Source File: WatchUpdaterService.java From NightWatch with GNU General Public License v3.0 | 5 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { double timestamp = 0; if (intent != null) { timestamp = intent.getDoubleExtra("timestamp", 0); } String action = null; if (intent != null) { action = intent.getAction(); } if (wear_integration) { if (googleApiClient.isConnected()) { //TODO Adrian: ACTION_OPEN_MENU? if (ACTION_RESEND.equals(action)) { resendData(); } else if (ACTION_OPEN_SETTINGS.equals(action)) { sendNotification(); } else { sendData(timestamp); } } else { googleApiClient.connect(); } } if (pebble_integration) { sendData(timestamp); } return START_STICKY; }
Example 7
Source File: IntentService.java From NightWatch with GNU General Public License v3.0 | 5 votes |
@Override protected void onHandleIntent(Intent intent) { if (intent == null) return; final String action = intent.getAction(); try { if (ACTION_NEW_DATA.equals(action)) { final double bgEstimate = intent.getDoubleExtra(Intents.EXTRA_BG_ESTIMATE, 0); if (bgEstimate == 0) return; int battery = intent.getIntExtra(Intents.EXTRA_SENSOR_BATTERY, 0); final Bg bg = new Bg(); bg.direction = intent.getStringExtra(Intents.EXTRA_BG_SLOPE_NAME); bg.battery = Integer.toString(battery); bg.bgdelta = (intent.getDoubleExtra(Intents.EXTRA_BG_SLOPE, 0) * 1000 * 60 * 5); bg.datetime = intent.getLongExtra(Intents.EXTRA_TIMESTAMP, new Date().getTime()); //bg.sgv = Integer.toString((int) bgEstimate, 10); bg.sgv = Math.round(bgEstimate)+""; bg.raw = intent.getDoubleExtra(Intents.EXTRA_RAW, 0); bg.save(); DataCollectionService.newDataArrived(this, true, bg); } } finally { WakefulBroadcastReceiver.completeWakefulIntent(intent); } }
Example 8
Source File: WatchUpdaterService.java From NightWatch with GNU General Public License v3.0 | 5 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { double timestamp = 0; if (intent != null) { timestamp = intent.getDoubleExtra("timestamp", 0); } String action = null; if (intent != null) { action = intent.getAction(); } if (wear_integration) { if (googleApiClient.isConnected()) { //TODO Adrian: ACTION_OPEN_MENU? if (ACTION_RESEND.equals(action)) { resendData(); } else if (ACTION_OPEN_SETTINGS.equals(action)) { sendNotification(); } else { sendData(timestamp); } } else { googleApiClient.connect(); } } if (pebble_integration) { sendData(timestamp); } return START_STICKY; }
Example 9
Source File: Activity_Balance.java From FoodOrdering with Apache License 2.0 | 5 votes |
/** * 获取从地址页面回传的数据 * * @param requestCode * @param resultCode * @param data */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case 1://地址 if (resultCode == RESULT_OK) { userName = data.getStringExtra("name"); phoneNumber = data.getStringExtra("phoneNumber"); sex = data.getStringExtra("sex"); address = data.getStringExtra("address"); longitude = data.getDoubleExtra("longitude", -1); latitude = data.getDoubleExtra("latitude", -1); tv_userName.setText(userName); tv_phoneNumber.setText(phoneNumber); tv_address.setText(address); if (sex.equals("男")) { tv_sex.setText("先生"); } else if (sex.equals("女")) { tv_sex.setText("女士"); } else { tv_sex.setText(sex); } } break; case 2://备注 if (resultCode == RESULT_OK) { remarkContent = data.getStringExtra("remarkContent"); tv_remarkContent.setText(remarkContent); } break; default: break; } }
Example 10
Source File: PbChatActivity.java From imsdk-android with MIT License | 5 votes |
public void selectLocationResult(Intent data) { QunarLocation location = new QunarLocation(); location.latitude = data.getDoubleExtra(Constants.BundleKey.LATITUDE, 0); location.longitude = data.getDoubleExtra(Constants.BundleKey.LONGITUDE, 0); location.addressDesc = data.getStringExtra(Constants.BundleKey.ADDRESS); location.fileUrl = data.getStringExtra(Constants.BundleKey.FILE_NAME); location.name = data.getStringExtra(Constants.BundleKey.LOCATION_NAME); chatingPresenter.sendLocation(location); }
Example 11
Source File: EaseChatFragment.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { if (requestCode == REQUEST_CODE_CAMERA) { // capture new image if (cameraFile != null && cameraFile.exists()) sendImageMessage(cameraFile.getAbsolutePath()); } else if (requestCode == REQUEST_CODE_LOCAL) { // send local image if (data != null) { Uri selectedImage = data.getData(); if (selectedImage != null) { sendPicByUri(selectedImage); } } } else if (requestCode == REQUEST_CODE_MAP) { // location double latitude = data.getDoubleExtra("latitude", 0); double longitude = data.getDoubleExtra("longitude", 0); String locationAddress = data.getStringExtra("address"); if (locationAddress != null && !locationAddress.equals("")) { sendLocationMessage(latitude, longitude, locationAddress); } else { Toast.makeText(getActivity(), R.string.unable_to_get_loaction, Toast.LENGTH_SHORT).show(); } } } }
Example 12
Source File: MapFragment.java From nearby-android with Apache License 2.0 | 5 votes |
@Override @Nullable public final View onCreateView(final LayoutInflater layoutInflater, final ViewGroup container, final Bundle savedInstance){ final View root = layoutInflater.inflate(R.layout.map_fragment, container,false); final Intent intent = getActivity().getIntent(); // If any extra data was sent, store it. if (intent.getSerializableExtra("PLACE_DETAIL") != null){ mCenteredPlaceName = getActivity().getIntent().getStringExtra("PLACE_DETAIL"); } if (intent.hasExtra("MIN_X")){ final double minX = intent.getDoubleExtra("MIN_X", 0); final double minY = intent.getDoubleExtra("MIN_Y", 0); final double maxX = intent.getDoubleExtra("MAX_X", 0); final double maxY = intent.getDoubleExtra("MAX_Y", 0); final String spatRefStr = intent.getStringExtra("SR"); if (spatRefStr != null ){ final Envelope envelope = new Envelope(minX, minY, maxX, maxY, SpatialReference.create(spatRefStr)); mViewpoint = new Viewpoint(envelope); } } showProgressIndicator("Loading map"); setUpMapView(root); return root; }
Example 13
Source File: ConversationFragment.java From Pix-Art-Messenger with GNU General Public License v3.0 | 4 votes |
private void handlePositiveActivityResult(int requestCode, final Intent data) { switch (requestCode) { case REQUEST_TRUST_KEYS_TEXT: sendMessage(); break; case REQUEST_TRUST_KEYS_ATTACHMENTS: commitAttachments(); break; case ATTACHMENT_CHOICE_CHOOSE_IMAGE: final List<Attachment> imageUris = Attachment.extractAttachments(getActivity(), data, Attachment.Type.IMAGE); mediaPreviewAdapter.addMediaPreviews(imageUris); toggleInputMethod(); break; case ATTACHMENT_CHOICE_TAKE_PHOTO: final Uri takePhotoUri = pendingTakePhotoUri.pop(); if (takePhotoUri != null) { mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), takePhotoUri, Attachment.Type.IMAGE)); activity.xmppConnectionService.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, takePhotoUri)); toggleInputMethod(); } else { Log.d(Config.LOGTAG, "lost take photo uri. unable to to attach"); } break; case ATTACHMENT_CHOICE_CHOOSE_FILE: case ATTACHMENT_CHOICE_RECORD_VIDEO: case ATTACHMENT_CHOICE_RECORD_VOICE: case ATTACHMENT_CHOICE_CHOOSE_VIDEO: final Attachment.Type type = requestCode == ATTACHMENT_CHOICE_RECORD_VOICE ? Attachment.Type.RECORDING : Attachment.Type.FILE; final List<Attachment> fileUris = Attachment.extractAttachments(getActivity(), data, type); mediaPreviewAdapter.addMediaPreviews(fileUris); toggleInputMethod(); break; case ATTACHMENT_CHOICE_LOCATION: double latitude = data.getDoubleExtra("latitude", 0); double longitude = data.getDoubleExtra("longitude", 0); Uri geo = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude)); mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), geo, Attachment.Type.LOCATION)); toggleInputMethod(); break; case REQUEST_INVITE_TO_CONVERSATION: XmppActivity.ConferenceInvite invite = XmppActivity.ConferenceInvite.parse(data); if (invite != null) { if (invite.execute(activity)) { activity.mToast = ToastCompat.makeText(activity, R.string.creating_conference, Toast.LENGTH_LONG); activity.mToast.show(); } } break; } }
Example 14
Source File: MainActivity.java From MapForTour with MIT License | 4 votes |
@Override public void onReceive(Context context, Intent intent) { switch (intent.getAction()) { //实时位置信息收到广播 case "cc.bitlight.broadcast.location.data": { NavigationViewItemLocateMode.setTitle("定位方式:" + application.getLocateMode()); NavigationViewItemLongitude.setTitle("经度:" + application.getLongitude()); NavigationViewItemLatitude.setTitle("纬度:" + application.getLatitude()); NavigationViewItemRadius.setTitle("精度:" + application.getRadius() + "米"); tvNavigationViewHeaderAddress.setText("当前位置:" + application.getAddress()); MyLocationData locData = new MyLocationData.Builder() .accuracy(application.getRadius()) .latitude(application.getLatitude()) .longitude(application.getLongitude()).build(); // 设置定位数据 mapFragment.setBaiduMapLocationData(locData); Log.d("lml", "location.data接收到"); } break; //实时周边信息收到广播 case "cc.bitlight.broadcast.nearbyinfo.data": { List<MyRadarNearbyInfo> myRadarNearbyInfoList = application.getMyRadarNearbyInfoList(); int infoListSize = myRadarNearbyInfoList.size(); nearbyFragment.setRadarNearbyInfoList(myRadarNearbyInfoList, infoListSize); mapFragment.setRadarNearbyInfoList(myRadarNearbyInfoList, infoListSize); Log.d("lml", "nearbyinfo.data接收到 ;" + "NearbyFragment:输出尺寸list.size():" + infoListSize); Message message = new Message(); message.what = MESSAGE_LOGIN_SUCCEED; handler.sendMessage(message); } break; //历史轨迹信息收到并请求绘制广播 case "cc.bitlight.broadcast.track.historytrack.draw": { Log.d("lml", "track.historytrack.draw收到" + intent.getDoubleExtra("distance", 0)); int distance = (int) intent.getDoubleExtra("distance", 0); NavigationViewItemTrackQuery.setTitle("轨迹查询:共" + distance + "米"); mapFragment.polylineHistoryTrace = new PolylineOptions(); mapFragment.refreshMapUI(); toolbarOperateCloseTrackOrOpenColor(true);//标红toolbar中轨迹清除按钮 } break; case "cc.bitlight.broadcast.geofence.reload": menuToolbarItemGeoFenceStatus.setTitle("围栏已开启"); menuToolbarItemGeoFenceStatus.setIcon(R.mipmap.menu_toolbar_ic_geofence_on); int radius = intent.getIntExtra("radius", 0); LatLng latLng = new LatLng(intent.getDoubleExtra("latitude", 0), intent.getDoubleExtra("longitude", 0)); mapFragment.createOrUpdateFenceShow(radius, latLng); break; case "cc.bitlight.broadcast.geofence.notification": String userID = intent.getStringExtra("userID"); int fenceStatus = intent.getIntExtra("fenceStatus", 0); if (fenceStatus == 1) { snackbar = Snackbar.make(coordinatorLayoutContainer, "用户\"" + userID + "\"已进入了指定范围", Snackbar.LENGTH_LONG); snackbar.setAction("查看详情", new View.OnClickListener() { @Override public void onClick(View v) { vp_FindFragment_pager.setCurrentItem(1); } }); snackbar.show(); } if (fenceStatus == 2) { snackbar = Snackbar.make(coordinatorLayoutContainer, "用户\"" + userID + "\"已离开了指定范围", Snackbar.LENGTH_LONG); snackbar.show(); } break; } }
Example 15
Source File: IntentHelper.java From OnActivityResult with Apache License 2.0 | 4 votes |
public static double getExtraDouble(final Intent intent, final String key, final double defaultValue) { return intent.getDoubleExtra(key, defaultValue); }
Example 16
Source File: IntentUtil.java From Ticket-Analysis with MIT License | 4 votes |
public static double getDoubleExtra(Intent intent, String name, double defaultValue) { if (!hasIntent(intent) || !hasExtra(intent, name)) return defaultValue; return intent.getDoubleExtra(name, defaultValue); }
Example 17
Source File: ConversationFragment.java From Conversations with GNU General Public License v3.0 | 4 votes |
private void handlePositiveActivityResult(int requestCode, final Intent data) { switch (requestCode) { case REQUEST_TRUST_KEYS_TEXT: sendMessage(); break; case REQUEST_TRUST_KEYS_ATTACHMENTS: commitAttachments(); break; case ATTACHMENT_CHOICE_CHOOSE_IMAGE: final List<Attachment> imageUris = Attachment.extractAttachments(getActivity(), data, Attachment.Type.IMAGE); mediaPreviewAdapter.addMediaPreviews(imageUris); toggleInputMethod(); break; case ATTACHMENT_CHOICE_TAKE_PHOTO: final Uri takePhotoUri = pendingTakePhotoUri.pop(); if (takePhotoUri != null) { mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), takePhotoUri, Attachment.Type.IMAGE)); toggleInputMethod(); } else { Log.d(Config.LOGTAG, "lost take photo uri. unable to to attach"); } break; case ATTACHMENT_CHOICE_CHOOSE_FILE: case ATTACHMENT_CHOICE_RECORD_VIDEO: case ATTACHMENT_CHOICE_RECORD_VOICE: final Attachment.Type type = requestCode == ATTACHMENT_CHOICE_RECORD_VOICE ? Attachment.Type.RECORDING : Attachment.Type.FILE; final List<Attachment> fileUris = Attachment.extractAttachments(getActivity(), data, type); mediaPreviewAdapter.addMediaPreviews(fileUris); toggleInputMethod(); break; case ATTACHMENT_CHOICE_LOCATION: double latitude = data.getDoubleExtra("latitude", 0); double longitude = data.getDoubleExtra("longitude", 0); Uri geo = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude)); mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), geo, Attachment.Type.LOCATION)); toggleInputMethod(); break; case REQUEST_INVITE_TO_CONVERSATION: XmppActivity.ConferenceInvite invite = XmppActivity.ConferenceInvite.parse(data); if (invite != null) { if (invite.execute(activity)) { activity.mToast = Toast.makeText(activity, R.string.creating_conference, Toast.LENGTH_LONG); activity.mToast.show(); } } break; } }
Example 18
Source File: BuzzerResourceP.java From SI with BSD 2-Clause "Simplified" License | 4 votes |
protected void setFromIntent(Intent intent) { double beep = intent.getDoubleExtra(msg_content_set, 0); Log.e(TAG, "Buzzer beep: " + String.valueOf(beep)); putRep(beep); }
Example 19
Source File: BuzzerResourceP.java From SI with BSD 2-Clause "Simplified" License | 4 votes |
protected void setFromIntent(Intent intent) { double beep = intent.getDoubleExtra(msg_content_set, 0); Log.e(TAG, "Buzzer beep: " + String.valueOf(beep)); putRep(beep); }
Example 20
Source File: MapService.java From MapForTour with MIT License | 4 votes |
@Override public void onReceive(Context context, Intent intent) { switch (intent.getAction()) { case "cc.bitlight.broadcast.service.start": //周边雷达EntityName设置 radarSearchManager.setUserID(application.getEntityName()); //周边雷达设置监听 radarSearchManager.addNearbyInfoListener(MapService.this); //设置自动上传位置 radarSearchManager.startUploadAuto(MapService.this, 5000); //实例化轨迹服务 trace = new Trace(getApplicationContext(), lbsTraceServiceId, application.getEntityName(), traceType); //开启轨迹服务 lbsTraceClient.startTrace(trace, MapService.this); //添加Entity lbsTraceClient.addEntity(lbsTraceServiceId, application.getEntityName(), "", myOnEntityListener); //查询围栏列表 lbsTraceClient.queryFenceList(lbsTraceServiceId, application.getEntityName(), "", myOnGeoFenceListener); //查询Entity列表 lbsTraceClient.queryEntityList(lbsTraceServiceId, application.getEntityName() + ",黄亚飞" + ",刘少飞" + ",马超", "", 0, 0, 1000, 1, myOnEntityListener); application.setLoginSucceed(true); break; case "cc.bitlight.broadcast.service.stop": //停止自动上传当前位置 radarSearchManager.stopUploadAuto(); //周边雷达移除监听 radarSearchManager.removeNearbyInfoListener(MapService.this); //停止轨迹服务 lbsTraceClient.stopTrace(trace, MapService.this); application.setLoginSucceed(false); break; //查询历史轨迹 case "cc.bitlight.broadcast.track.queryhistorytrack": queryHistoryTrack(intent.getStringExtra("entityName")); break; //设置地理围栏 case "cc.bitlight.broadcast.geofence.query": Log.d("lml", "已收到地理围栏广播"); switch (intent.getStringExtra("type")) { case "create": double longitude = intent.getDoubleExtra("longitude", 0); double latitude = intent.getDoubleExtra("latitude", 0); int radius = intent.getIntExtra("radius", 0); String userId = intent.getStringExtra("userId"); if (preFenceId == -50) createGroFence(longitude, latitude, radius, userId); else updateGroFence(longitude, latitude, radius, userId); break; case "delete": queryFenceEntityStatus = false; deleteGeoFence(); preFenceId = -50; break; } break; case "cc.bitlight.broadcast.mytemp": Log.d("lml", "myServiceReceiver:收到测试广播"); queryFenceEntityStatus = true; lbsTraceClient.queryMonitoredStatus(lbsTraceServiceId, preFenceId, "", myOnGeoFenceListener); break; } }