當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.getDoubleExtra方法代碼示例

本文整理匯總了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));

}
 
開發者ID:sommukhopadhyay,項目名稱:nirbhaya,代碼行數:32,代碼來源:NirbhayaMapsActivity.java

示例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"));
}
 
開發者ID:thingyherb,項目名稱:FamilyLibraryManager,代碼行數:19,代碼來源:DetailsActivity.java

示例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));
        }
    }

}
 
開發者ID:organizationAllink,項目名稱:wzyx-android-user,代碼行數:25,代碼來源:NearFragment.java

示例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);

}
 
開發者ID:if710,項目名稱:2017.2-codigo,代碼行數:14,代碼來源:MapActivity.java

示例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());
            }
        });
    }
}
 
開發者ID:LewisVo,項目名稱:Overkill,代碼行數:34,代碼來源:DownloadMap.java

示例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();
            }
            
        }
    }
}
 
開發者ID:turoDog,項目名稱:KTalk,代碼行數:28,代碼來源:EaseChatFragment.java

示例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();
            }

        }
    }
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:28,代碼來源:EaseChatFragment.java

示例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);
	}
}
 
開發者ID:runtimeco,項目名稱:Android-DFU-App,代碼行數:11,代碼來源:HTSActivity.java

示例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));
}
 
開發者ID:JW1992,項目名稱:NISTGammaSearch,代碼行數:12,代碼來源:CalcAttenuationActivity.java

示例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();
    }
}
 
開發者ID:tringuyen1121,項目名稱:Khonsu,代碼行數:14,代碼來源:SensorServiceReceiver.java

示例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);
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:15,代碼來源:JournalViewActivity.java

示例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();
                }
            }
        }
    }
}
 
開發者ID:VitorPoncell,項目名稱:poturnoChat,代碼行數:48,代碼來源:ChatActivity.java

示例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();
    }
}
 
開發者ID:yuhodev,項目名稱:login,代碼行數:42,代碼來源:MapSetUp.java


注:本文中的android.content.Intent.getDoubleExtra方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。