- android: find current location in map and save it as a picture
- public class newGameSetUp extends Activity{
- private static final int SELECT_PICTURE = 1;
- private String selectedImagePath=""; //path of the image selected
- private String filemanagerstring;
- Bitmap bMap = null;
- ImageView img;
- Button newgame;
- private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in Meters
- private static final long MINIMUM_TIME_BETWEEN_UPDATES = 1000; // in Milliseconds
- protected LocationManager locationManager;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setTitle("Picture Puzzle");
- setContentView(R.layout.newscreen);
- newgame = (Button)findViewById(R.id.button2);
- newgame.setTextColor(Color.GRAY);
- final Button back = (Button)findViewById(R.id.button3);
- img = (ImageView)findViewById(R.id.imageView1);
- final Button load = (Button)findViewById(R.id.button1);
- final RadioGroup mRadioGroup = (RadioGroup) findViewById(R.id.radioGroup1);
- final Button map = (Button)findViewById(R.id.button4);
- locationManager.requestLocationUpdates(
- LocationManager.GPS_PROVIDER,
- MINIMUM_TIME_BETWEEN_UPDATES,
- MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
- new MyLocationListener()
- );
- map.setOnClickListener(new OnClickListener(){
- @Override
- public void onClick(View arg0) {
- Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
- String address = (location.getLongitude()+" "+ location.getLatitude());
- address.replace(' ', '+');
- Intent geoIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address));
- startActivity(geoIntent);
- }
- });