Re: [android-developers] Find the location in Android Map

2010-09-16 Thread Frank Weiss
On Wed, Sep 15, 2010 at 9:56 PM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

  I thought you want to to display a mark on a map from the latitude and
 longitude a user entered in two text fields. But I don't understand if you
 want to display that on a MapActivity in your app or in another app.
 - I want to display that  on a MapActivity in my app. Not in another
 activity.




OK, but I'm not following the code you posted. What is supposed to happen
after startActivity():

public void onClick(View v) {
// TODO Auto-generated method stub
String _lat = lat.getText().toString();
String _lng = lng.getText().toString();
Uri uri = Uri.parse(geo:+_lat+,+_lng);
startActivity(new Intent(Intent.ACTION_VIEW, uri));

It's unclear why you are doing that from the MapActivity itself. Also, I
mentioned earlier that the latititude and longitude from the text boxes are
not used anywhere else.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 7:18 AM, dhrumil dhrumilsh...@gmail.com wrote:

 I have a problem in that.


And the problem is what?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
The problem is that I am not able to find that exact location and not able
to put marker on that location.

~Dhr

On Wed, Sep 15, 2010 at 6:01 PM, TreKing treking...@gmail.com wrote:

  On Wed, Sep 15, 2010 at 7:18 AM, dhrumil dhrumilsh...@gmail.com wrote:

 I have a problem in that.


 And the problem is what?


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 7:37 AM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 The problem is that I am not able to find that exact location and not able
 to put marker on that location.


And what exactly is that exact location?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
The exact location is the location entered by the user in the edit text i.e.
the latitude and longitude of that location.

If u didnt get my question, I can send u my code then run it and suggest me.

~Dhr

On Wed, Sep 15, 2010 at 7:00 PM, TreKing treking...@gmail.com wrote:

  On Wed, Sep 15, 2010 at 7:37 AM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 The problem is that I am not able to find that exact location and not able
 to put marker on that location.


 And what exactly is that exact location?



 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 8:46 AM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 The exact location is the location entered by the user in the edit text
 i.e. the latitude and longitude of that location.


OK. So user entered location as lat and lon. Why can't you plot it? What's
the EXACT problem? What have you tried so far?


  If u didnt get my question, I can send u my code then run it and suggest
 me.


No.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
The problem is that zoom of the map is maximum, every time I have to zoom
out the map to show the exact location. And I am not able to put marker on
that location.

~Dhr

On Wed, Sep 15, 2010 at 7:40 PM, TreKing treking...@gmail.com wrote:

 On Wed, Sep 15, 2010 at 8:46 AM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 The exact location is the location entered by the user in the edit text
 i.e. the latitude and longitude of that location.


 OK. So user entered location as lat and lon. Why can't you plot it? What's
 the EXACT problem? What have you tried so far?


  If u didnt get my question, I can send u my code then run it and suggest
 me.


 No.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 12:14 PM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 The problem is that zoom of the map is maximum


You can change this at any time.


 every time I have to zoom out the map to show the exact location.


Or you can animate or snap to the exact location.


 And I am not able to put marker on that location.


Why not?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
You can change this at any time.
- Ya, i know that thing, but its not working in my this application.

Or you can animate or snap to the exact location.
- I used this method but it generates and force close error on my emulator.

Why not?
-I dont know why not. I try to debug it but it gives me nothing.

~Dhr

On Wed, Sep 15, 2010 at 10:46 PM, TreKing treking...@gmail.com wrote:

 On Wed, Sep 15, 2010 at 12:14 PM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 The problem is that zoom of the map is maximum


 You can change this at any time.


 every time I have to zoom out the map to show the exact location.


 Or you can animate or snap to the exact location.


 And I am not able to put marker on that location.


 Why not?



 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 12:42 PM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 You can change this at any time.
 - Ya, i know that thing, but its not working in my this application.


It's not working is not useful information.


 Or you can animate or snap to the exact location.
 - I used this method but it generates and force close error on my emulator.


Did you check the stack trace?


 Why not?
 -I dont know why not. I try to debug it but it gives me nothing.


Nothing? No logs, no stack trace?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
Hey TreKing,

If you dont mind, just refer this code.
You exactly got what is going on here. I am new in Android so I dont know
what is stack trace and log? How to check stack trace?

So here is my code.

public class ShowLocation extends MapActivity {
private EditText lat;
private EditText lng;
 GeoPoint gp=null;
 MapController  mapcontroller;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button btn = (Button)findViewById(R.id.btnShow);
lat = (EditText)findViewById(R.id.lat);
lng = (EditText)findViewById(R.id.lng);

MapView mapView = (MapView)findViewById(R.id.myGMap);

mapcontroller = mapView.getController();

//gp = new GeoPoint(lat.intValue(), lng.intValue());
mapView.setSatellite(true);
mapView.setTraffic(true);
mapView.setStreetView(true);
mapView.displayZoomControls(true);
mapView.setBuiltInZoomControls(true);

//mapcontroller.animateTo(gp);
mapcontroller.setZoom(2);
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);

Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(true);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setPowerRequirement(Criteria.POWER_HIGH);
String provider = locationManager.getBestProvider(criteria, true);

 Location location = locationManager.getLastKnownLocation(provider);

btn.setOnClickListener(new View.OnClickListener() {
 @Override
public void onClick(View v) {
// TODO Auto-generated method stub
String _lat = lat.getText().toString();
String _lng = lng.getText().toString();
Uri uri = Uri.parse(geo:+_lat+,+_lng);
 startActivity(new Intent(Intent.ACTION_VIEW, uri));
//mapcontroller.animateTo(gp);
mapcontroller.setZoom(2);
}
});
String _lat,_lng;
MapOverlay mylocationoverlay = new MapOverlay();
ListOverlay list = mapView.getOverlays();
list.add(mylocationoverlay);
}
 protected class MapOverlay extends com.google.android.maps.Overlay{
 public boolean draw(Canvas canvas, MapView myGMap, boolean shadow, long
when){
Paint paint = new Paint();
//mapcontroller.animateTo(gp);
super.draw(canvas, myGMap, shadow);
 Point myScreenCoords = new Point();
//mapview.getProjection().toPixels(gp, myScreenCoords);
//paint.setARGB(255, 255, 255, 255);
Drawable marker = getResources().getDrawable(R.drawable.marker);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.marker);
canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);
canvas.drawText(Location is at here.., myScreenCoords.x, myScreenCoords.y,
paint);
return true;
}
}
 @Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}

~Dhr


On Wed, Sep 15, 2010 at 11:17 PM, TreKing treking...@gmail.com wrote:

 On Wed, Sep 15, 2010 at 12:42 PM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 You can change this at any time.
 - Ya, i know that thing, but its not working in my this application.


 It's not working is not useful information.


 Or you can animate or snap to the exact location.
 - I used this method but it generates and force close error on my
 emulator.


 Did you check the stack trace?


 Why not?
 -I dont know why not. I try to debug it but it gives me nothing.


 Nothing? No logs, no stack trace?


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread TreKing
On Wed, Sep 15, 2010 at 12:59 PM, Dhrumil Shah dhrumilsh...@gmail.comwrote:

 I am new in Android so I dont know what is stack trace and log? How to
 check stack trace?


http://developer.android.com/guide/developing/debug-tasks.html

Start reading =)

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Frank Weiss
I see a couple of issues with your code.

1) The location variable set in the following line does not appear to be
used anywher:

Location location = locationManager.getLastKnownLocation(provider);

2) Are you trying to send an intent to the Maps or Browser app, of handle
the location display yourself? In one place the code has:

startActivity(new Intent(Intent.ACTION_VIEW, uri));

yet in another line, the code goes:

canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
Hey Frank,

Then you told me what do I do??

~Dhr

On Thu, Sep 16, 2010 at 12:43 AM, Frank Weiss fewe...@gmail.com wrote:

 I see a couple of issues with your code.

 1) The location variable set in the following line does not appear to be
 used anywher:

 Location location = locationManager.getLastKnownLocation(provider);

 2) Are you trying to send an intent to the Maps or Browser app, of handle
 the location display yourself? In one place the code has:

 startActivity(new Intent(Intent.ACTION_VIEW, uri));

 yet in another line, the code goes:

 canvas.drawBitmap(bitmap, myScreenCoords.x, myScreenCoords.y, paint);

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Frank Weiss
I want to help you, but I don't clearly understand what you want to do.

I thought you want to to display a mark on a map from the latitude and
longitude a user entered in two text fields. But I don't understand if you
want to display that on a MapActivity in your app or in another app.

One thing that may help is if you try to display a mark on a map foir a
given latitude and longitude instead of from a user's input. Have you been
able to do that successfully?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Find the location in Android Map

2010-09-15 Thread Dhrumil Shah
I thought you want to to display a mark on a map from the latitude and
longitude a user entered in two text fields. But I don't understand if you
want to display that on a MapActivity in your app or in another app.
- I want to display that  on a MapActivity in my app. Not in another
activity.


One thing that may help is if you try to display a mark on a map foir a
given latitude and longitude instead of from a user's input. Have you been
able to do that successfully?
- Yes, I tried with that also. Firstly, I entered hardcore values in the app
of latitude and longitude. Its working.
But everytime we have to change it for different locations. Thats why I put
EditText and button so user can enter its own latitude and longitude.

~Dhr.

On Thu, Sep 16, 2010 at 9:27 AM, Frank Weiss fewe...@gmail.com wrote:

 I want to help you, but I don't clearly understand what you want to do.

 I thought you want to to display a mark on a map from the latitude and
 longitude a user entered in two text fields. But I don't understand if you
 want to display that on a MapActivity in your app or in another app.

 One thing that may help is if you try to display a mark on a map foir a
 given latitude and longitude instead of from a user's input. Have you been
 able to do that successfully?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en