[android-developers] Re: How to calculate the distance between two degree values? (for example: 350º to 15º = 25º / 250º to 190º = 60º)

2011-09-27 Thread Lew Bloch


On Tuesday, September 27, 2011 7:29:09 AM UTC-7, saex wrote:
>
> there is a function or something on Java to calculate the distance 
> between two degree values? (min 0º and max 360º) 
>
> for example: 
>
> 350º to 15º = 25º 
>
> 250º to 190º = 60º 
>
>
Which way do you want it?  They cannot both be correct.

Bearing is conventionally calculated positive-clockwise with 0° at North (or 
"face forward" for relative bearing), most maths work 
positive-counterclockwise with 0° corresponding to the positive x axis.
 
Either way, 350° to 15° is +25° or -335°, and 250° to 190° is -60° or +300°, 
depending on how you want to play it.

You can use the remainder operator or manually add or subtract 360° to make 
things fall into your desired target range.  Your basic operation is 
subtraction modulo 360.  A conventional range is [-180°, 180°).

etc... 
>
>
"Etc." takes a single period to end the abbreviation.  The term "etc." only 
makes sense once you have established a consistent pattern, which your post 
did not.

-- 
Lew

-- 
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

[android-developers] Re: Android is worst os mobile is this true

2011-09-21 Thread Lew Bloch
Android is the worst form of mobile OS except for all those other forms that 
have been tried from time to time ...
-- Apologies to unknown source as cited by Winston Churchill.


-- 
Lew

blake wrote:
>
> Oh man.  This is such a bummer.  I'd been thinking it was pretty 
> cool... 
>
> wanyce ashoura wrote: 
>
>> [Android is worst os mobile is this true]

> > Yes i should say that 
> > Why because of more then one reason 
> > 1- not support Arabic language at all meaning you need long time to 
> > get Arabic support 
> > in any kind of android Mobile's 
> > 2- alot of futures not founded in android like what 
> > * redial . 
> > *voice mail . 
> > *gps navigator offline . 
> > * voice command offline . 
> > *proxy . 
> > * a lot of security issues . 
> > *suck in browsing web site's 
> > *crazy market request any program will some times downloaded and may 
> > will not or pause download . 
> > 3- is android real free software and  open source i do not think so is 
> > near to windows mobile 
> > just android use linux kernel and java but is not cool at all 
> > 4-blue tooth is crazy to used in android 
> > 5-not support any thing we dream about it 
> > about me i am waiting for the best came from android from long time 
> > before 
> > and now i have no hope about this os because is just another low level 
> > mobile os like symbian or badi or windows 
> > low level meaning is not reach what we as user's wanted not is 
> > programing 
> > 5- release 1.5 and 2.0 2.1 2.2 2.3 and jump to 3.0 3.1 3.2 
> > but what about other version's is them not deserve some of update's 
> > and improvement 
> > just jump like this .. 
> > 
> == 
> > i hope this e-mail reach real developer behind android and them start 
> > moving up and 
> > give us some hope to we can have mobile's can do what almost we 
> > wanted

 

-- 
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] Is this a joke??

2011-09-20 Thread Lew Bloch
https://memegen.googleplex.com/906

Daniel Drozdzewski wrote:
>
> Steven Bruce wrote:
> > 
> http://developer.android.com/reference/android/app/ActivityManager.html#isUserAMonkey()
> >
> > What is this supposed to do? Looks like Google having a laugh or
> > something?? :p

 

> http://developer.android.com/guide/developing/tools/monkey.html
>
-- 
Lew

-- 
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

[android-developers] Re: Vector

2011-08-24 Thread Lew Bloch
+1 to blake's comments.

A couple more points, inline:

blake wrote:
>
> Chris is right, that gets rid of the error, but I bet it is not what 
> bob is trying to accomplish.  Chris' solution will create a Java array 
> of 9 Vectors. 
>
> I have a couple of suggestions, here: 
> 1) Don't ever use Vectors.  They are historical cruft.  Use List and 
> ArrayList 
>

In particular, the methods of 'Vector' are synchronized, which is often not 
what you want or need, and it contains legacy methods and members that are 
not compatible with the collections framework.   'Vector' has been out of 
date since 1998!  It never ceases to amaze me that people still want to use 
it.  I will bet dollars to doughnuts that the OP wasn't programming with 
Java yet in 1998.

2) Don't mix generics and Java arrays.  It gets weird 
>

That's putting it mildly.  The Java Language Specification explicitly 
states, "... the element type in an array creation expression cannot be a 
parameterized type, other than an unbounded wildcard." 
(§15.10 
http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#46168 
)

> I suspect that what bob wants is 
> 
> import java.util.List; 
> 
> public class Oracle { 
> public static List articles; 
> public static void init(){ 
> articles = new ArrayList(9); 
> } 
> } 
> 
> ... and you can leave the "9" out, because the ArrayList will grow as 
needed... 

Note blake declares the variable 'articles' as type 'List' rather than an 
unnecessarily specific type, adhering to "Item 52: Refer to objects by their 
interfaces" from _Effective Java_ by Joshua Bloch.
http://java.sun.com/docs/books/effective/toc.html

Chris wrote: 
> >> articles = new Vector[9]; 
> > 
> > try articles = (Vector[]) new Vector[9]; 
>

Again, neither of these is legal.  You can get around it with 
'@SuppressWarnings', but shouldn't.

The chapter on generics from _Effective Java_ [_op. cit._] is free to 
download and will help here.

Take heed of "Item 23: Don't use raw types in new code".

-- 
Lew

-- 
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

[android-developers] Re: Simulate GPS Failure

2011-08-24 Thread Lew Bloch
Parking garages have worked very well to block GPS and other signals in my 
experience.

Nathan: How do you do a mock location provider?

-- 
Lew

On Tuesday, August 23, 2011 6:12:05 PM UTC-7, davemac wrote:
>
> You might try holding it inside your kitchen oven (oven not turned on 
> of course). 
>
> - dave 
>
> On Aug 23, 9:07 pm, burton miller  wrote: 
> > I'm not sure about the type of failure, because it does not happen in 
> > my code - it happens in the advertiser's code, and some of my users 
> > are getting a dialog telling them that 'GPS is failing.'  My code 
> > fails gracefully on location problems :) 
> > 
> > If I can repro it, then I can determine which advertiser it is, and 
> > contact them.  That is a serious bug. 
> > 
> > I'll try the metal building trick.  Maybe a parking garage. 
> > 
> > On Aug 23, 4:26 pm, Nathan  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > On Aug 23, 3:08 pm, burton miller  wrote: 
> > 
> > > > I have an app that uses ads for revenue.  And one of my ad vendors is 
>
> > > > putting up a show-stopper dialog when GPS is on, but fails.  I can't 
> > > > tell which one it is. 
> > 
> > > > How do you simulate GPS failure (while enabled)?  Any ideas? 
> > 
> > > What type of failure? Failure to receive a position update? 
> > > Real GPS or network location? 
> > 
> > > If real GPS, try it inside a building with a metal roof, like a mall. 
> > 
> > > You could also do a mock location provider. 
>
>

-- 
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

[android-developers] Re: How to detect "&" HTML tag?

2011-08-11 Thread Lew Bloch
On Aug 8, 10:43 pm, ndiiie90 wrote:
> What i mean is to replace all "&" tags in data that is retrieved from
> database..
>
> So for example,
>
> the data is:
>
> I am a java & android developer
>
> will be replaced into:
>
> I am a java & android developer

That is not a valid replacement, actually, as entities are set off by
ampersand and semicolon characters, e.g., "&".

> How can i do that? I think it is not effective to replace all & tag by
> proper character

What exactly do you mean by "not effective" and why do you think that
would be a problem?

The classes and methods suggested by other respondents would be quite
effective as far as I can tell.  You might also consider the
java.util.regex package.  In the same package with android.text.Html
there are other potentially useful classes, such as
android.text.TextUtils.

Bear in mind that there a quite a few entities you will want to parse.


--
Lew

-- 
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