本文整理汇总了Java中android.content.Intent.getDoubleExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getDoubleExtra方法的具体用法?Java Intent.getDoubleExtra怎么用?Java Intent.getDoubleExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.getDoubleExtra方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapReady
import android.content.Intent; //导入方法依赖的package包/类
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
Intent tmp = getIntent();
double lat = tmp.getDoubleExtra("lat", 0.0);
double lon = tmp.getDoubleExtra("lon", 0.0);
LatLng phoneLocation = new LatLng(lat, lon);
mMap.addMarker(new MarkerOptions().position(phoneLocation).title("Here i am..."));
//mMap.animateCamera( CameraUpdateFactory.zoomTo( 17.0f ) );
//mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(phoneLocation,17));
//mMap.moveCamera(CameraUpdateFactory.newLatLng(phoneLocation));
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(phoneLocation) // Sets the center of the map to location user
.zoom(16) // Sets the zoom
.build(); // Creates a CameraPosition from the builder
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
示例2: getBook
import android.content.Intent; //导入方法依赖的package包/类
private void getBook(Intent intent) {
String bookId = intent.getStringExtra("bookId");
Double price = intent.getDoubleExtra("price", 0.00);
TextView bookIdTextView = (TextView) findViewById(bookNumberEditText);
bookIdTextView.setText(bookId);bookIdTextView.setFocusable(false);
TextView bookNameTextView = (TextView) findViewById(bookNameEditText);
bookNameTextView.setText(intent.getStringExtra("bookName"));
TextView typeTextView = (TextView) findViewById(bookTypeEditText);
typeTextView.setText(intent.getStringExtra("type"));
TextView authorTextView = (TextView) findViewById(bookAuthorEditText);
authorTextView.setText(intent.getStringExtra("author"));
TextView priceTextView = (TextView) findViewById(bookPriceEditText);
priceTextView.setText(price.toString());
TextView borrowerTextView = (TextView) findViewById(R.id.bookBorrowerEditText);
borrowerTextView.setText(intent.getStringExtra("borrower"));
TextView publicationDateTextView = (TextView) findViewById(R.id.bookDateEditText);
publicationDateTextView.setText(intent.getStringExtra("publicationDate"));
}
示例3: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == REQUEST_CODE_PICK_CITY){
if(resultCode == RESULT_OK){
//从CityPickerActivity获取位置信息
tvPosition.setText(data.getStringExtra(CityPickerActivity.KEY_PICKED_CITY));
lat = data.getDoubleExtra(CityPickerActivity.KEY_LAT, 0);
lng = data.getDoubleExtra(CityPickerActivity.KEY_LNG, 0);
LogUtil.d(TAG,"lat: "+lat+"\n"+"lng: "+lng);
showAndHideActivityList(SHOW);
getActivityList(lat, lng);
}else {
tvPosition.setText(getResources().getString(R.string.locate));
lat = 0;
lng = 0;
//定位失败
showAndHideActivityList(HIDE);
ToastUtil.toastShort(_mActivity,getResources().getString(R.string.locate_error));
}
}
}
示例4: onCreate
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
Intent i = getIntent();
latitude = i.getDoubleExtra(LAT_KEY,-8.047);
longitude = i.getDoubleExtra(LON_KEY,-34.876);
SupportMapFragment mapa = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapa);
mapa.getMapAsync(this);
}
示例5: onCreate
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.download);
listView = (ListView) findViewById(android.R.id.list);
registerForContextMenu(listView);
List<GLMapDownloadTask> tasks = GLMapManager.getMapDownloadTasks();
GLMapManager.addStateListener(this);
Intent i = getIntent();
center = new MapPoint(i.getDoubleExtra("cx", 0.0), i.getDoubleExtra("cy", 0.0));
long collectionID = i.getLongExtra("collectionID", 0) ;
if(collectionID!=0)
{
GLMapInfo collection = GLMapManager.getMapWithID(collectionID);
if(collection != null)
{
updateAllItems(collection.getMaps());
}
}else
{
updateAllItems(GLMapManager.getMaps());
GLMapManager.updateMapList(this, new Runnable(){
@Override
public void run()
{
updateAllItems(GLMapManager.getMaps());
}
});
}
}
示例6: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@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();
}
}
}
}
示例7: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@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();
}
}
}
}
示例8: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(final Context context, final Intent intent) {
final String action = intent.getAction();
if (HTSService.BROADCAST_HTS_MEASUREMENT.equals(action)) {
final double value = intent.getDoubleExtra(HTSService.EXTRA_TEMPERATURE, 0.0f);
// Update GUI
setHTSValueOnView(value);
}
}
示例9: onCreate
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calc_attenuation);
Intent intent = getIntent();
fEnergyList = intent.getDoubleArrayExtra(DisplayMaterialActivity.ATTEN_ENERGY);
fCoeffList = intent.getDoubleArrayExtra(DisplayMaterialActivity.ATTEN_COEFF);
fDensity = intent.getDoubleExtra(SearchOptionSelect.SEARCH_OBJECT_DENSITY, 0.0);
EditText editTextDensity = (EditText) findViewById(R.id.editTextDensity);
editTextDensity.setText(Double.toString(fDensity));
}
示例10: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(SensorService.STEP_UPDATE)) {
boolean isWalking = intent.getBooleanExtra(SensorService.STEPS, false);
if (isWalking) {
updateLocation();
}
} else if (intent.getAction().equals(SensorService.ANGLE_UPDATE)) {
currentAzimuth = intent.getDoubleExtra(SensorService.ANGLE, 0);
animateNavigator();
isCorrectDirection();
}
}
示例11: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
String key;
synchronized (dayToTemp) {
key = intent.getStringExtra(WeatherService.EXTRA_KEY);
double temperature = intent.getDoubleExtra(WeatherService
.EXTRA_TEMP, 0.0);
String icon = intent.getStringExtra(WeatherService.EXTRA_ICON);
dayToTemp.put(key, temperature);
}
int section = seenDates.indexOf(key);
int pos = adapter.positionOfSection(section);
adapter.notifyItemChanged(pos);
}
示例12: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == LOCATION_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
double lat = data.getDoubleExtra("lat", 0);
double lng = data.getDoubleExtra("lng", 0);
Log.i("LOCATION", "lat: " + lat + ", lng: " + lng);
String mensageValue = "lat: " + lat + ", lng: " + lng;
Mensage mensage = new Mensage();
mensage.setUserId(senderContactId);
mensage.setMensage(mensageValue);
Boolean senderMensageSaved = saveMensage(senderContactId, destinationContactId, mensage);
if (!senderMensageSaved) {
Toast.makeText(ChatActivity.this, "Problema ao salvar mensagem", Toast.LENGTH_LONG).show();
} else {
Boolean destinatioMensageSaved = saveMensage(destinationContactId, senderContactId, mensage);
if (!destinatioMensageSaved) {
Toast.makeText(ChatActivity.this, "Problema ao enviar mensagem", Toast.LENGTH_LONG).show();
}
}
Chat chat = new Chat();
chat.setSenderId(senderContactId);
chat.setUserId(destinationContactId);
chat.setName(destinationContactName);
chat.setMensageValue(mensageValue);
Boolean senderChatSaved = saveChat(senderContactId, destinationContactId, chat);
if (!senderChatSaved) {
Toast.makeText(ChatActivity.this, "Problema ao salvar conversa", Toast.LENGTH_LONG).show();
} else {
chat = new Chat();
chat.setUserId(senderContactId);
chat.setName(senderContactName);
chat.setMensageValue(mensageValue);
Boolean destinationChatSaved = saveChat(destinationContactId, senderContactId, chat);
if (!destinationChatSaved) {
Toast.makeText(ChatActivity.this, "Problema ao enviar conversa", Toast.LENGTH_LONG).show();
}
}
}
}
}
示例13: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode != 2) {
String title = data.getStringExtra("title");
String intro = data.getStringExtra("intro");
String method = data.getStringExtra("method");
String tag = data.getStringExtra("tag");
String time = data.getStringExtra("time");
double latitude = data.getDoubleExtra("latitude", 0);
double longitude = data.getDoubleExtra("longitude", 0);
switch (requestCode) {
case 0:
setMarker(new LatLng(latitude, longitude), title, intro, method, time, tag);
sum += 1;
break;
case 1:
cilckMarker.setTitle(title + " - " + intro);
cilckMarker.setSnippet(method + " (" + time + ")");
// 更新相应的markers数组值
for (com.gyh.login.db.Marker marker : markers) {
if (marker.getLatitude() == cilckMarker.getPosition().getLongitude()
&& marker.getLongitude() == cilckMarker.getPosition().getLatitude()) {
marker.setTitle(title);
marker.setSnippet(intro);
marker.setMethod(method);
marker.setTime(time);
marker.setTag(tag);
}
}
break;
}
} else if (resultCode == RESULT_OK && requestCode == 2) {
String routeTitle = data.getStringExtra("routeTitle");
String routeIntro = data.getStringExtra("routeIntro");
saveRoute(routeTitle, routeIntro);
finish();
}
}