[android-beginners] Re: WQVGA not respecting android:layout_height="fill_parent" for layout.

2010-08-06 Thread ckloch
I have got some support on this and my problem is now solved both on
Android 1.5 and 2.1

Best regards
ckloch

On 17 Jun., 20:41, ckloch  wrote:
> Thanks for this inspiring contribtion.
>
> I have just ran in to the same problem with a HTC Hero Android 1.5
> By using android:layout_width="fill_parent", the screen does only take
> approximately half of the width of the screen while the rest is black.
>
> So, does it mean that I have to dictate the width in inches/mm to fill
> the entire width of the screen, or are there other ways to do?
>
> Thank you for your helpckloch
>
> On 14 Maj, 19:18, Stormtap Studios  wrote:
>
>
>
> > Ok, that makes sense for 1.6+ devices.  What will happen on small
> > screen devices like QVGA-P and QVGA-L running 1.5 if you specify a -
> > small resource folder?  Will it use the -small folder if that minimum
> > sdk level is set, or does that SDK level just know nothing about that
> > folder and keep on using the regular ones?
>
> > Rob
>
> > On May 14, 10:03šam, Kostya Vasilyev  wrote:
>
> > > You can build against 1.6 and set min-sdk to 3, also set supports-screens
> > > for high and low screen support.
>
> > > There was a topic here recently about properly specifying drawables.
>
> > > 14 ÍÁÑ, 2010 8:47 PM ÐÏÌØÚÏ×ÁÔÅÌØ "Stormtap Studios" <
> > > r...@stormtapstudios.com> ÎÁÐÉÓÁÌ:
>
> > > I've found the reason this happens. šAccording to the documentation:
>
> > > "Compatibility-mode display on larger screen-sizes
> > > If the current screen's size is larger than your application supports,
> > > as specified in the supports-screens element, the platform displays
> > > the application at the baseline size ("normal") and density ("medium).
> > > For screens larger than baseline, the platform displays the
> > > application in a baseline-sized portion of the overall screen, against
> > > a black background."
>
> > > This is what's happening to me.
>
> > > Unfortunately my app is being built against Android 1.5 and I can't
> > > include the  tag in the manifest to indicate that I
> > > support the large screens which would allow it to scale properly.
> > > Does anyone know of a way to tell the screen to stretch /fill_parent
> > > on large screens in Android 1.5?
>
> > > Thanks,
>
> > > Rob
>
> > > On May 13, 7:43 pm, Stormtap Studios  wrote: > 
> > > Hi
> > > guys, > > I have this l...> NEW! Try asking and tagging your question on 
> > > Stack Overflow athttp://
>
> > > stackoverflow.com/questions/tagged/android
>
> > > > > To unsubscribe from this group, send email to >
>
> > > android-beginners+unsubscr...@googlegroups.com > >  i...@googlegroups.com>> For more options, visit this group athttp://
>
> > > groups.google.com/group/android-beginners?hl=en
>
> > > -- You received this message because you are subscribed to the Google 
> > > Groups
> > > "Android Beginners" g...
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Beginners" group.
>
> > > NEW! Try asking and tagging your question on Stack Overflow 
> > > athttp://stackoverflow.com/questions/tagged/android
>
> > > To unsubscribe from this group, send email to
> > > android-beginners+unsubscr...@googlegroups.com
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/android-beginners?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
>
> > NEW! Try asking and tagging your question on Stack Overflow 
> > athttp://stackoverflow.com/questions/tagged/android
>
> > To unsubscribe from this group, send email to
> > android-beginners+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-beginners?hl=en-Skjul tekst i 
> > anførselstegn -
>
> > - Vis tekst i anførselstegn -- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For 
more information about this change, please read [http://goo.gl/xkfl] or visit 
the Group home page.

Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: How comes that the estimate time becomes negative

2010-08-06 Thread ckloch
Dear all,

I have solved my problem, so the issue below is no logner relevant

Thank you for all the great input I have got in this forum

best regards
CKLOCH

On 22 Jun., 11:25, ckloch  wrote:
> Dear all,
>
> I have developed a small app that helps the driver to regulate his
> speed in order to pass the traffic light when it is green; and thereby
> minimizing the number of times that he has to stop for red.
>
> But, the app does not always work as anticipated.
> In my app, I need to get the timedifference from when he starts
> driving to the actual time.
> This time is needed in order to calculate whether he will reach the
> light when it is green, or if he needs to slow down in case the
> current speed is too high.
>
> I will appreciate any help that can guide me in the right direction to
> identify the problem: is it due to Java and that it cannot control the
> on-going queueing of GPS data? is it due to problems with HTC Hero and
> Android 1.5; or is it something much more simple that causes my
> problem. Please, send me your input.
> I have inserted the most relevant parts of the code below which is
> structurized as:
>
> 1) gpspos() is the function called when I want to start the routine
> (the main app is launched before).
>
> 2) initial_time should contain the timesample from when I call the
> routine. That is the reason why I set it to zero in the beginning and
> then update it the first time the conditions  distance_1< radius and
> counter_L are fulfilled. These conditions are fulfilled when I call
> gpspos().
>
> 3) time=location.getTime() is the GPS clock.
>
> 4) double spend_time_1_sec = (time - initial_time); determines the
> time spend since I called gpspos().
>
> Thank you for your time and helpCKLOCH
>
> public void gpspos() {
> super.onResume();
>
> LocationManager locMgr = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
>                 LocationListener locListener = new LocationListener()
>                 {
>
>                 double initial_time = 0;
>
>                 public void    onLocationChanged(Location location)
>                 {
>
>                     if (location != null)
>                             {
>                             double time = location.getTime()/1000;
>                             double spend_time_1_sec = (time -
> initial_time);
>
>                                 if (distance_1 counter_L==1)  // This is only true once when the routine gpspos() is
> called
>                         {
>                         initial_time = location.getTime()/1000; //
> initial_time is in seconds
>                         }
>                             }
>                 }
>
>
>
> }- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For 
more information about this change, please read [http://goo.gl/xkfl] or visit 
the Group home page.

Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: how to change colours in a .xml defined layout in run time

2010-08-06 Thread ckloch
Thank you very much for your input
I have solved the problem and the application is now ready for trial.

best regards
ckloch

On 23 Jun., 17:38, TreKing  wrote:
> On Wed, Jun 16, 2010 at 6:55 AM, ckloch  wrote:
> > In theory it seems to be easy, but I would highly appreciate your help on
> > how to do this in Android as I cannot see how I start changing the colours
> > of the individual bar in the screen after initially defining the screen.
>
> Whatever View you're using to represent the bars should have some background
> property for changing it's background image or color. Try that.
>
> ---­--
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For 
more information about this change, please read [http://goo.gl/xkfl] or visit 
the Group home page.

Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] How comes that the estimate time becomes negative

2010-06-22 Thread ckloch
Dear all,

I have developed a small app that helps the driver to regulate his
speed in order to pass the traffic light when it is green; and thereby
minimizing the number of times that he has to stop for red.

But, the app does not always work as anticipated.
In my app, I need to get the timedifference from when he starts
driving to the actual time.
This time is needed in order to calculate whether he will reach the
light when it is green, or if he needs to slow down in case the
current speed is too high.

I will appreciate any help that can guide me in the right direction to
identify the problem: is it due to Java and that it cannot control the
on-going queueing of GPS data? is it due to problems with HTC Hero and
Android 1.5; or is it something much more simple that causes my
problem. Please, send me your input.
I have inserted the most relevant parts of the code below which is
structurized as:

1) gpspos() is the function called when I want to start the routine
(the main app is launched before).

2) initial_time should contain the timesample from when I call the
routine. That is the reason why I set it to zero in the beginning and
then update it the first time the conditions  distance_1< radius and
counter_L are fulfilled. These conditions are fulfilled when I call
gpspos().

3) time=location.getTime() is the GPS clock.

4) double spend_time_1_sec = (time - initial_time); determines the
time spend since I called gpspos().

Thank you for your time and help
CKLOCH

public void gpspos() {
super.onResume();

LocationManager locMgr = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
LocationListener locListener = new LocationListener()
{

double initial_time = 0;

public voidonLocationChanged(Location location)
{

if (location != null)
{
double time = location.getTime()/1000;
double spend_time_1_sec = (time -
initial_time);

if (distance_1http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: WQVGA not respecting android:layout_height="fill_parent" for layout.

2010-06-17 Thread ckloch
Thanks for this inspiring contribtion.

I have just ran in to the same problem with a HTC Hero Android 1.5
By using android:layout_width="fill_parent", the screen does only take
approximately half of the width of the screen while the rest is black.

So, does it mean that I have to dictate the width in inches/mm to fill
the entire width of the screen, or are there other ways to do?

Thank you for your help
ckloch


On 14 Maj, 19:18, Stormtap Studios  wrote:
> Ok, that makes sense for 1.6+ devices.  What will happen on small
> screen devices like QVGA-P and QVGA-L running 1.5 if you specify a -
> small resource folder?  Will it use the -small folder if that minimum
> sdk level is set, or does that SDK level just know nothing about that
> folder and keep on using the regular ones?
>
> Rob
>
> On May 14, 10:03šam, Kostya Vasilyev  wrote:
>
>
>
>
>
> > You can build against 1.6 and set min-sdk to 3, also set supports-screens
> > for high and low screen support.
>
> > There was a topic here recently about properly specifying drawables.
>
> > 14 ÍÁÑ, 2010 8:47 PM ÐÏÌØÚÏ×ÁÔÅÌØ "Stormtap Studios" <
> > r...@stormtapstudios.com> ÎÁÐÉÓÁÌ:
>
> > I've found the reason this happens. šAccording to the documentation:
>
> > "Compatibility-mode display on larger screen-sizes
> > If the current screen's size is larger than your application supports,
> > as specified in the supports-screens element, the platform displays
> > the application at the baseline size ("normal") and density ("medium).
> > For screens larger than baseline, the platform displays the
> > application in a baseline-sized portion of the overall screen, against
> > a black background."
>
> > This is what's happening to me.
>
> > Unfortunately my app is being built against Android 1.5 and I can't
> > include the  tag in the manifest to indicate that I
> > support the large screens which would allow it to scale properly.
> > Does anyone know of a way to tell the screen to stretch /fill_parent
> > on large screens in Android 1.5?
>
> > Thanks,
>
> > Rob
>
> > On May 13, 7:43 pm, Stormtap Studios  wrote: > Hi
> > guys, > > I have this l...> NEW! Try asking and tagging your question on 
> > Stack Overflow athttp://
>
> > stackoverflow.com/questions/tagged/android
>
> > > > To unsubscribe from this group, send email to >
>
> > android-beginners+unsubscr...@googlegroups.com > i...@googlegroups.com>> For more options, visit this group athttp://
>
> > groups.google.com/group/android-beginners?hl=en
>
> > -- You received this message because you are subscribed to the Google Groups
> > "Android Beginners" g...
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
>
> > NEW! Try asking and tagging your question on Stack Overflow 
> > athttp://stackoverflow.com/questions/tagged/android
>
> > To unsubscribe from this group, send email to
> > android-beginners+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-beginners?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow 
> athttp://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-beginners?hl=en- Skjul tekst i 
> anførselstegn -
>
> - Vis tekst i anførselstegn -

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] how to change colours in a .xml defined layout in run time

2010-06-16 Thread ckloch
Dear friends,

I am developing a small app that should inform the drivers whether his
current speed matches the preferred one in order to avoid stopping for
the red light.

I have no probelms to calculate the relative speed of the vehicle and
compare it with the preferred speed in order to determine and inform
the driver whether his speed is appropriate for crossing the traffic
light when it is green, or he needs to slow down or speed up.

But, I would be very thankful if you can help me to display this
graphically.

My current idea is to draw a traffic light (in red and green) on the
screen in .xml, using 11 equally sized bars. Hereby, I can show
whether the speed fits perfectly (then bar 6 should be black), or
there is no room for delay (then bar 4 should be black)
So far, I have made the traffic light in .xml.

My next step is to change the color of one of the bars dependent on
how the relative speed matches the shifts in the traffic light.
In theory it seems to be easy, but I would highly appreciate your help
on how to do this in Android as I cannot see how I start changing the
colours of the individual bar in the screen after initially defining
the screen.

There might be other and better ways to implement this than .xml

I would appreciate your help;

Best regards
ckloch

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Calculating distance between GPS position and way_point

2010-06-03 Thread ckloch
But, then it would be great to get some help understanding the
explanation.

It says (see 
http://developer.android.com/reference/android/location/Location.html)
"The computed distance is stored in results[0]. If results has length
2 or greater, the initial bearing is stored in results[1]. If results
has length 3 or greater, the final bearing is stored in results[2]."

But what does it mean by length 2 or greater?

How can I be sure that I read the correct result by reading
results[0] ?(I assume it is as I have compared it with the actual
physical distance).

The answer might be straightforward, but I would really appreciate
some help on this.

Thank you patience
ckloch



On 2 Jun., 18:33, TreKing  wrote:
> On Wed, Jun 2, 2010 at 7:07 AM, ckloch  wrote:
> > But what do the different options 1, 2 and 3 in float[] results =
> > new float[1] refer to ?
>
> This is explained in the documentation for that function.
>
> ---­--
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Calculating distance between GPS position and way_point

2010-06-02 Thread ckloch
Thank you for your help. The method works fine.

I just have one more questions, which solve my current problem
regarding the accuracy.

I am using the command Location.distanceBetween(lat1, lon1, lat2,
lon2, results); to find the distance to a fix point.
Unfortunately, my app and I do not agree on the distance.

The current code looks like
float[] results = new float[1]; // 1, 2 or 3 depending on what
information you want
Location.distanceBetween(lat1, lon1, lat2, lon2, results);
float distance = results[0];

So far, I am specifying the fix point with 5 digits (e.g. 55.65786,
12.27229 according to Googlemaps).
The GPS coordinates are read as 55.6579399,12.2684776
The calculated distance is 239 m

But what do the different options 1, 2 and 3 in float[] results = new
float[1] refer to ?

Best Regards
ckloch


On 21 Maj, 18:03, TreKing  wrote:
> On Fri, May 21, 2010 at 7:25 AM, ckloch  wrote:
> > I am importíng android.location.location and then trying the line float
> > results [] = distanceBetween(lat_a1, lng_a1, lat_b1, lng_b1);
>
> Well that doesn't make sense since it doesn't match the function
> signature...
>
> > My problem is that I get the error message: "The method
> > distanceBetween(double, double, double, double) is undefined for the type
> > new LocationListener(){}" and I don't know how to interprete it.
>
> This means exactly what it says - that the method you're using,
> distanceBetween, is not defined for the type for which you're trying to use
> it.
>
> You use it like this:
> float[] results = new float[1]; // 1, 2 or 3 depending on what information
> you want
> Location.distanceBetween(lat1, lon1, lat2, lon2, results);
> float distance = results[0];
>
> > Furthermore, I will be very thankful is you can help me by reading
> > the time, and timedifference between a number of readings, as I need
> > the timedifference to estimate an average speed over a distance travelled.
>
> I have no idea what you're asking.
>
> > I understand all the input parameters, but what about the output "float
> > results[]" Does it mean that I can write the line
>
> > distanceBetween(double startLatitude, double startLongitude, double
> > endLatitude, double endLongitude, float[] results);
>
> See above.
>
> ---­--
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow 
> athttp://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] How to set the length of what is presented by Toast.maketext()

2010-06-02 Thread ckloch
Dear All,

As part of my program development, I am using the command
Toast.makeText(getBaseContext(), " Latitude [" +
location.getLatitude() + "] longitude [" + location.getLongitude()
+"]", Toast.LENGTH_SHORT).show();
to display the current coordinates

The command works fine and display the coordinates as planned.
My only problem is related to what is displayed.
So far, I display the full result with approx 14 digits.
It would be great if I could present the results with only 5 digits.

Please, can you help me? Is there a command that I can add to truncate
the results from 14 to 5 digits?

Best Regards
ckloch

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Calculating distance between GPS position and way_point

2010-05-21 Thread ckloch
Thank you for your input.
I have tried using it but it seems to be more challenging than
expected.

I am importíng android.location.location and then trying the line
float results [] = distanceBetween(lat_a1, lng_a1, lat_b1, lng_b1);
where lat_a1, lng_a1, lat_b1 and lng_b1 have all been converted to
double (I am using them as float earlier in my program).
The values of lat_a1 and lat_b1 equals the GPS coordinates read using
location.getLatitude(); and location.getLongitude();

My problem is that I get the error message:
"The method distanceBetween(double, double, double, double) is
undefined for the type new LocationListener(){}"
and I don't know how to interprete it.

Furthermore, I will be very thankful is you can help me by reading the
time, and timedifference between a number of readings, as I need the
timedifference to estimate an average speed over a distance travelled.

Thank you for your help
ckloch



I understand all the input parameters, but what about the output
"float results[]"
Does it mean that I can write the line

distanceBetween(double startLatitude, double startLongitude, double
endLatitude, double endLongitude, float[] results);


Does it mean that if I enter the command

On 20 Maj, 20:13, TreKing  wrote:
> On Thu, May 20, 2010 at 6:21 AM, ckloch  wrote:
> > Please, let me know how I can solve this problem. I believe that there must
> > be easier way to calculate this distance, but I have found any.
>
> Try 
> this:http://developer.android.com/intl/fr/reference/android/location/Locat...,
> double, double, double, float[])
>
> ---­--
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow 
> athttp://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Calculating distance between GPS position and way_point

2010-05-20 Thread ckloch
Dear all,

I am working on a small app that can calculate the distance between
actual location and a predefined location.

I am using the commands location.getLatitude and location.getLongitude
to get the GPS position in Degrees Decimal Degrees.

I define a fixed location as double like
double Fixed_Lat = 55.8;
double Fixed_Long =  12.8;

>From here I would like to calculate the distance by first calculate
the Distance_square (works fine)
double Distance_square = (Fixed_Lat -
location.getLatitude())*(Fixed_Lat - location.getLatitude()) +
(Fixed_Long - location.getLongitude())*(Fixed_Long -
location.getLongitude());

Hereafter I would like to calculate the Distance by taking the
squareroot of Distance_square
Unfortunately it seems like that square root requires a float instead
of a double.
I have tried to use
float Distance = FloatMath.sqrt(double Distance_square);
but without any success

Please, let me know how I can solve this problem. I believe that there
must be easier way to calculate this distance, but I have found any.
I am looking forward to your help.

best Regards
ckloch

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] How can I find out if I read the GPS signal

2010-04-07 Thread ckloch
As part of an application for registrer whether a vehicle can pass the
next traffic light without having stop for red light, I am trying to
get the GPS Location.

So far I have tried the code below, but the HTC Tattoo telephone keeps
stopping the application.
The reason is that the List providers remains empty.

Is there any way that I can extend my code, so I can understand why
providers remains empty.
I know I get a NullPointerException, but I don't know why as GPS is
enabled.

I will really appreciate your help on how to get
- status of the GPS
- content of providers.

The code is listed below (I don't get any compilation errors):

protected void onResume() {
List providers;
final String tag = "readdata";

super.onResume();

locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
providers = locationManager.getProviders(true);

if (!providers.isEmpty()) {
 location = locationManager.getLastKnownLocation((String)
providers
.get(0));
 locationManager.requestLocationUpdates((String)
providers.get(0),
 15000, 1, this);
 }
 GeoPoint p = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));


 mc.animateTo(p);
 mc.setZoom(17);
 mapView.setSatellite(true);
 mapView.setStreetView(true);
 mapView.invalidate();

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe, reply using "remove me" as the subject.


[android-beginners] Re: List providers - does it work for Android 1.5?

2010-03-31 Thread ckloch
Dear Andrian.

Thank you for your feed-back.
I keep on trying to understand List providers.
It should provide me a list of GPS satelitte from where I can read the
coordinates.
Unfortunately, providers is empty and hence my HTC Hero force me to
close it when running on the phone and reaches the line
GeoPoint p = new GeoPoint((int) (location.getLatitude() * 1E6),
   (int) (location.getLongitude() * 1E6));
I have no problem in compilling the code.

Ideas are very welcome as well as code examples (I have inserted my
code below)
Thanks in advance.

protected void onResume() {
List providers;

super.onResume();

locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
providers = locationManager.getProviders(true);

if (!providers.isEmpty()) {
 location = locationManager.getLastKnownLocation((String)
providers
.get(0));
 locationManager.requestLocationUpdates((String)
providers.get(0),
 15000, 1, this);
 }
 GeoPoint p = new GeoPoint((int) (location.getLatitude() * 1E6),
   (int) (location.getLongitude() * 1E6));


 mc.animateTo(p);
 mc.setZoom(17);
 mapView.setSatellite(true);
 mapView.setStreetView(true);
 mapView.invalidate();

}

On 29 Mar., 15:20, Adrian Vintu  wrote:
> List providers;
>
> Normally you should get only some warning on this, but it depends on your
> switches.
>
> If you use Eclipse, just hover over your error/warning and you will get
> options on how to fix it. Also Ctrl+1 to get the options.
>
> BR,
> Adrian Vintuhttp://adrianvintu.com
>
>
>
> On Mon, Mar 29, 2010 at 3:08 PM, ckloch  wrote:
> > In my effort to develop a small location finder app for HTC Hero with
> > Android 1.5, I am using the code below that should work on Android
> > 1.6.
> > My problem is that includes the commandline to find the available GPS
> > satelittes: List providers;
>
> > Eclipse tells me that I have to parameterize List, but not how.
> > Please, help me to understand List providers and what I can do to get
> > it working?
> > Thank you in advance for your help.
>
> > protected void onResume() {
> >        List providers;
> >        super.onResume();
>
> >        locationManager = (LocationManager)
> > getSystemService(Context.LOCATION_SERVICE);
> >        providers = locationManager.getProviders(true);
>
> >            if (!providers.isEmpty()) {
> >              location = locationManager.getLastKnownLocation((String)
> > providers
> >                   .get(0));
> >               locationManager.requestLocationUpdates((String)
> > providers.get(0),
> >                   15000, 1, this);
> >             }
> >             GeoPoint p = new GeoPoint((int) (location.getLatitude() *
> > 1E6),
> >                 (int) (location.getLongitude() * 1E6));
> >             mc.animateTo(p);
> >             mc.setZoom(17);
> >             mapView.setSatellite(true);
> >             mapView.setStreetView(true);
> >             mapView.invalidate();
>
> >    }
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
>
> > NEW! Try asking and tagging your question on Stack Overflow at
> >http://stackoverflow.com/questions/tagged/android
>
> > To unsubscribe from this group, send email to
> > android-beginners+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-beginners?hl=en
>
> > To unsubscribe from this group, send email to android-beginners+
> > unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> > ME" as the subject.- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe, reply using "remove me" as the subject.


[android-beginners] List providers - does it work for Android 1.5?

2010-03-29 Thread ckloch
In my effort to develop a small location finder app for HTC Hero with
Android 1.5, I am using the code below that should work on Android
1.6.
My problem is that includes the commandline to find the available GPS
satelittes: List providers;

Eclipse tells me that I have to parameterize List, but not how.
Please, help me to understand List providers and what I can do to get
it working?
Thank you in advance for your help.

protected void onResume() {
List providers;
super.onResume();

locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
providers = locationManager.getProviders(true);

if (!providers.isEmpty()) {
  location = locationManager.getLastKnownLocation((String)
providers
   .get(0));
   locationManager.requestLocationUpdates((String)
providers.get(0),
   15000, 1, this);
 }
 GeoPoint p = new GeoPoint((int) (location.getLatitude() *
1E6),
 (int) (location.getLongitude() * 1E6));
 mc.animateTo(p);
 mc.setZoom(17);
 mapView.setSatellite(true);
 mapView.setStreetView(true);
 mapView.invalidate();

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe from this group, send email to 
android-beginners+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.


[android-beginners] how to read integers from a string

2010-02-16 Thread ckloch
Dear all,

I hope that you can help me.
Currently, I am reading the content of a small txt-file containing the
following rows (the first number in the rows is the row number):
1,1,2,2,4
2,1,4,5,6
3,5,6,7,8

So far, I read each row as a string.
Therefore, I am looking for a way to read the different integers from
that string so I manipulate the numbers by simple math. Maybe
ContentResolver from java.loang.Object is a way forward, but it
challenges me

Please, let me know your ideas:

public int readdata() {

this.setContentView(R.layout.read_rawresource_file);

this.readOutput = (TextView) findViewById(R.id.readrawres_output);

Resources resources = getResources();
InputStream is = null;
try {
is = resources.openRawResource(R.raw.rutetal);
byte[] reader = new byte[is.available()];
while (is.read(reader) != -1) {
}
this.readOutput.setText(new String(reader));
} catch (IOException e) {
Log.e(GreenWave.LOGTAG, e.getMessage(), e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
}
}
};


}

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] How to create a table that can be read by Android

2010-02-16 Thread ckloch
Dear All,

I am about to create a table with integers and float.
The content of the table should later be read by an application.

Therefore I am very curious if I can simply make a table using
commaseparation in a .xml file, e.g.
Row 1: 1,2,3,4,5
Row 2: 3,1,6,5,7
Row 3: 5,4,3,6,9

and so forth?

Thank you for your help


-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] How to move the calculations of one class to a separate class and return the results

2010-02-16 Thread ckloch
It is great to see that there is a group for Android beginners.

I am trying to get some experience with Android.
One of the things I have tried doing most of the day is call a class.
Currently, the program is doing fine with only one class, but it will
be great to move the calculation part to a separate class and then
return the results. This means that the lines from the code below
should be moved to a separate class;
// calculate the result
Time_from_start = 20;
Time_to_arrival = 2;
Arrival_time = Time_from_start+Tiime_to_arrival;


The working code looks like this:

package ti.igts.greenwave;

import android.app.Activity;
import android.os.Bundle;
import java.text.NumberFormat;
import ti.igts.greenwave.R;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class GreenWave extends Activity {
/** Called when the activity is first created. */
public float Time_from_start;
public float Time_to_arrival;
public float Arrival_time;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.welcomemain);

final TextView answerfield = (TextView)
findViewById(R.id.answer);
String answer = "";

NumberFormat nf = java.text.NumberFormat.getNumberInstance();

// calculate the result
Time_from_start = 20;
Time_to_arrival = 2;
Arrival_time = Time_from_start+Time_to_arrival;
answer = "Time of Arrival  " + nf.format(Arrival_time);
// display the answer
answerfield.setText(answer);

}

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en