Java Code Examples for android.content.Intent.getDoubleExtra()

The following are Jave code examples for showing how to use getDoubleExtra() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: nirbhaya   File: NirbhayaMapsActivity.java   View Source Code Vote up 13 votes
/**
 * 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));

}
 
Example 2
Project: FamilyLibraryManager   File: DetailsActivity.java   View Source Code Vote up 8 votes
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"));
}
 
Example 3
Project: wzyx-android-user   File: NearFragment.java   View Source Code Vote up 8 votes
@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));
        }
    }

}
 
Example 4
Project: 2017.2-codigo   File: MapActivity.java   View Source Code Vote up 7 votes
@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);

}
 
Example 5
Project: Overkill   File: DownloadMap.java   View Source Code Vote up 7 votes
@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());
            }
        });
    }
}
 
Example 6
Project: KTalk   File: EaseChatFragment.java   View Source Code Vote up 6 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 7
Project: Tribe   File: EaseChatFragment.java   View Source Code Vote up 6 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 8
Project: Tribe   File: EaseChatFragment.java   View Source Code Vote up 6 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 9
Project: Android-DFU-App   File: HTSActivity.java   View Source Code Vote up 6 votes
@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);
	}
}
 
Example 10
Project: NISTGammaSearch   File: CalcAttenuationActivity.java   View Source Code Vote up 6 votes
@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));
}
 
Example 11
Project: Khonsu   File: SensorServiceReceiver.java   View Source Code Vote up 6 votes
@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();
    }
}
 
Example 12
Project: FanChat   File: EaseChatFragment.java   View Source Code Vote up 6 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 13
Project: GCSApp   File: EaseChatFragment.java   View Source Code Vote up 6 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 14
Project: mobile-app-dev-book   File: JournalViewActivity.java   View Source Code Vote up 6 votes
@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);
}
 
Example 15
Project: mobile-app-dev-book   File: JournalViewActivity.java   View Source Code Vote up 6 votes
@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);
}
 
Example 16
Project: mobile-app-dev-book   File: JournalViewActivity.java   View Source Code Vote up 6 votes
@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);
}
 
Example 17
Project: poturnoChat   File: ChatActivity.java   View Source Code Vote up 5 votes
@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();
                }
            }
        }
    }
}
 
Example 18
Project: login   File: MapSetUp.java   View Source Code Vote up 5 votes
@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();
    }
}