android.content.Intent.getDoubleExtra()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(473)

本文整理了Java中android.content.Intent.getDoubleExtra()方法的一些代码示例,展示了Intent.getDoubleExtra()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.getDoubleExtra()方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:getDoubleExtra

Intent.getDoubleExtra介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Test
public void testDoubleExtra() throws Exception {
 Intent intent = new Intent();
 assertSame(intent, intent.putExtra("foo", 2d));
 assertEquals(2d, intent.getExtras().get("foo"));
 assertThat(intent.getDoubleExtra("foo", -1)).isEqualTo(2d);
}

代码示例来源:origin: stackoverflow.com

@Override
public void onReceive(Context context, Intent intent) {
  double latitude = intent.getDoubleExtra(LocationBroadcastService.EXTRA_LATITUDE, 0);
  double longitude = intent.getDoubleExtra(LocationBroadcastService.EXTRA_LONGITUDE, 0);
  textView.setText("Lat: " + latitude + ", Lng: " + longitude);

代码示例来源:origin: kingthy/TVRemoteIME

double vol = intent.getDoubleExtra("volume", 0);
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
int curVol = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);

代码示例来源:origin: fossasia/pslab-android

tv_time.setText(sdt.format(startDate));
latitude = intent.getDoubleExtra(LATITUDE, 0.0);
longitude = intent.getDoubleExtra(LONGITUDE, 0.0);

代码示例来源:origin: stackoverflow.com

Intent in = getIntent();
   h_id = in.getStringExtra("h_id");
   lat1 = in.getDoubleExtra("lat1", 0);
   lon1 = in.getDoubleExtra("lon1", 0);

代码示例来源:origin: stackoverflow.com

Intent in = getIntent();
   h_id = in.getStringExtra("h_id");
   lat1 = in.getDoubleExtra("lat1", 0);
   lon1 = in.getDoubleExtra("lon1", 0);

代码示例来源:origin: stackoverflow.com

Intent i = new Intent();
 i.putExtra("key", doubleValue);
 i.getDoubleExtra("key", defValue);

代码示例来源:origin: stackoverflow.com

FragmentManager myFragmentManager = getActivity().getSupportFragmentManager();
 SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager.findFragmentById(R.id.map);
 myMap = mySupportMapFragment.getMap();
 myMap.setMyLocationEnabled(true);
 myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
 Intent intent = getActivity().getIntent();
 double spotLat = intent.getDoubleExtra("LAT", 21.139);
 double spotLng = intent.getDoubleExtra("LNG", 105.851);
 int latitude = (int) (spotLat * GEO_CONVERSION);
 int longitude = (int) (spotLng * GEO_CONVERSION);
 LatLng point = new LatLng(latitude, longitude);
 myMap.addMarker(new MarkerOptions().position(point).title(intent.getStringExtra("NAME") + "\n" + intent.getStringExtra("ADD")));
 myMap.getUiSettings().setCompassEnabled(true);
 myMap.getUiSettings().setZoomControlsEnabled(true);
 myMap.animateCamera(CameraUpdateFactory.newLatLng(point));

代码示例来源:origin: iotoasis/SI

protected void setFromIntent(Intent intent) {
  double beep = intent.getDoubleExtra(msg_content_set, 0);
  Log.e(TAG, "Buzzer beep: " + String.valueOf(beep));
  putRep(beep);
}

代码示例来源:origin: mark-ypq/GPSHook

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode==0x01&&resultCode==Activity.RESULT_OK){
    SharedPreferences sp = getSharedPreferences("markypq", MODE_WORLD_READABLE);
    SharedPreferences.Editor e = sp.edit();
    e.putString("lan", data.getDoubleExtra("lan",0)+"");
    e.putString("lon", data.getDoubleExtra("lon",0)+"");
    e.commit();
    initView();
  }
  super.onActivityResult(requestCode, resultCode, data);
}

代码示例来源:origin: stackoverflow.com

// Define the callback for what to do when data is received
private BroadcastReceiver locationReceiver = new BroadcastReceiver() {

  @Override
  public void onReceive(Context context, Intent intent) {

    Log.d(TAG, "Broadcastreceiver Coordinates");

    int resultCode = intent.getIntExtra("resultCode", RESULT_CANCELED);
    if (resultCode == RESULT_OK) {
      Double latitude= intent.getDoubleExtra("latitude",0);
      Double longitude= intent.getDoubleExtra("longitude",0);

      DashboardFragment dashboardFrag  = (DashboardFragment)
          manager.findFragmentByTag("Dashboard");
      dashboardFrag .updateLocation(latitude.toString(),longitude.toString());
      Log.d(TAG, latitude.toString()+" --- "+longitude.toString());
    }
  }
};

代码示例来源:origin: Yuanarcheannovice/BaiduMapDemo

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (requestCode == AppStaticVariable.MAP_SEARCH_CODE && resultCode == Activity.RESULT_OK) {
    if (data != null) {
      String address = data.getStringExtra(AppStaticVariable.MAP_SEARCH_ADDRESS);
      double lon = data.getDoubleExtra(AppStaticVariable.MAP_SEARCH_LONGITUDE, 0.0);
      double lat = data.getDoubleExtra(AppStaticVariable.MAP_SEARCH_LATITUDE, 0.0);
      mSer.searchStr(address, lon, lat);
    }
  }
}

代码示例来源:origin: JackWHLiu/jackknife

public static double getDoubleExtra(Intent intent, String name, double defaultValue) {
  if (intent != null || !hasExtra(intent, name)) return defaultValue;
  return intent.getDoubleExtra(name, defaultValue);
}

代码示例来源:origin: BaaSBeginner/leanchat-android

private void processMap(Intent intent) {
 final double latitude = intent.getDoubleExtra(LocationActivity.LATITUDE, 0);
 final double longitude = intent.getDoubleExtra(LocationActivity.LONGITUDE, 0);
 final String address = intent.getStringExtra(LocationActivity.ADDRESS);
 if (!TextUtils.isEmpty(address)) {
  AVIMLocationMessage locationMsg = new AVIMLocationMessage();
  locationMsg.setLocation(new AVGeoPoint(latitude, longitude));
  locationMsg.setText(address);
  sendMessage(locationMsg);
 } else {
  Toast.makeText(getContext(), R.string.chat_cannotGetYourAddressInfo, Toast.LENGTH_SHORT).show();
 }
}

代码示例来源:origin: xiaolongonly/Ticket-Analysis

public static double getDoubleExtra(Intent intent, String name, double defaultValue) {
  if (!hasIntent(intent) || !hasExtra(intent, name)) return defaultValue;
  return intent.getDoubleExtra(name, defaultValue);
}

代码示例来源:origin: Michenux/YourAppIdea

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (requestCode == SELECTCITY_REQUESTCODE && resultCode == CityActivity.RESULT_OK) {
    this.updateCityView(data.getStringExtra(CityListFragment.CITY_NAME), data.getStringExtra(CityListFragment.CITY_COUNTRY));
    this.mCurrentLocation = new Location("manual");
    this.mCurrentLocation.setLatitude(data.getDoubleExtra(CityListFragment.CITY_LATITUDE, 0));
    this.mCurrentLocation.setLongitude(data.getDoubleExtra(CityListFragment.CITY_LONGITUDE, 0));
    this.mUseLocationClient = false;
    this.mPlaceProvider.onLocationChanged(this.mCurrentLocation);
  }
}

代码示例来源:origin: andforce/iBeebo

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.map);
  // getActionBar().setDisplayShowHomeEnabled(false);
  // getActionBar().setDisplayShowTitleEnabled(true);
  // getActionBar().setDisplayHomeAsUpEnabled(false);
  // getActionBar().setTitle(getString(R.string.browser_map));
  lat = getIntent().getDoubleExtra("lat", 0);
  lon = getIntent().getDoubleExtra("lon", 0);
  locationStr = getIntent().getStringExtra("locationStr");
  setUpMapIfNeeded();
}

代码示例来源:origin: blockchain/Android-Merchant-App

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.activity_receive);
  initViews();
  //Register receiver (Listen for incoming tx)
  IntentFilter filter = new IntentFilter(MainActivity.ACTION_INTENT_INCOMING_TX);
  LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(receiver, filter);
  //Incoming intent value
  double amountFiat = this.getIntent().getDoubleExtra(PaymentFragment.AMOUNT_PAYABLE_FIAT, 0.0);
  double amountBtc = this.getIntent().getDoubleExtra(PaymentFragment.AMOUNT_PAYABLE_BTC, 0.0);
  tvFiatAmount.setText(getCurrencySymbol()+" "+ MonetaryUtil.getInstance().getFiatDecimalFormat().format(amountFiat));
  tvBtcAmount.setText(MonetaryUtil.getInstance().getBTCDecimalFormat().format(amountBtc) + " " + PaymentFragment.DEFAULT_CURRENCY_BTC);
  getReceiveAddress(amountBtc, tvFiatAmount.getText().toString());
}

代码示例来源:origin: NativeMonkey/ofo

@Override
protected void onCreate(Bundle bundle) {
  super.onCreate(bundle);
  setContentView(R.layout.route_activity);
  if(getIntent()!=null)
  {
    mStartPoint = new LatLonPoint(getIntent().getDoubleExtra("start_lat",39.942295),getIntent().getDoubleExtra("start_lng",116.335891));;
    mEndPoint =new LatLonPoint(getIntent().getDoubleExtra("end_lat",39.942295),getIntent().getDoubleExtra("end_lng",116.335891));
  }
  mContext = this.getApplicationContext();
  mapView = (MapView) findViewById(R.id.route_map);
  mapView.onCreate(bundle);// 此方法必须重写
  init();
  setfromandtoMarker();
  searchRouteResult(ROUTE_TYPE_WALK, RouteSearch.WalkDefault);
}

代码示例来源:origin: NativeMonkey/ofo

@Override
protected void onCreate(Bundle bundle) {
  super.onCreate(bundle);
  setContentView(R.layout.route_activity);
  if(getIntent()!=null)
  {
    mStartPoint = new LatLonPoint(getIntent().getDoubleExtra("start_lat",39.942295),getIntent().getDoubleExtra("start_lng",116.335891));;
    mEndPoint =new LatLonPoint(getIntent().getDoubleExtra("end_lat",39.942295),getIntent().getDoubleExtra("end_lng",116.335891));
  }
  mContext = this.getApplicationContext();
  mapView = (MapView) findViewById(R.id.route_map);
  mapView.onCreate(bundle);// 此方法必须重写
  init();
  setfromandtoMarker();
  searchRouteResult(ROUTE_TYPE_RIDE, RouteSearch.RidingDefault);
}

相关文章

Intent类方法