android RegEx external GPS string

I have a problem with seperating information in a string i get from the external GPS stream.

Heres a example of a string:

$GPGSV,3,3,12,22,09,276,31,25,24,247,24,27,54,131,,32,04,359,19*71
$GPGLL,5703.85365,N,00953.88360,E,075510.00,A,A*69
$GPPWR,028a,1,0,1,1
$GPRMC,075511.00,A,5703.85369,N,00953.88430,E,0.335,302.17,070912,,,A*6E
$GPVTG,302.17,T,,M,0.335,N,0.621,K,A*3A

Want i am trying to do is to get the " $GPGLL,5703.85365,N,00953.88360,E,075510.00,A,A*69 " out so i can grab the longtitude and latitude and then update my textview with it. But keep getting string out of bounch exeption and i start wondering if i am handling this in the wrong way.

Anyone that can put me in the right direction in how to solve this?

Answers


Here's an approach to handling NMEA sentences directly from the GPS:

    // Listener for NMEA sentences
public void  onNmeaReceived(long timestamp, String nmea) {
            // Split the sentence into its comma-separated pieces
    String [] sentence = nmea.split(",");
            // See if it's the sentence we're interested in
    if(sentence[0].equalsIgnoreCase("$GPGLL")) {
    /* In here, process the data components of the sentence, which will
               be in sentence[1], sentence[2], etc. */
        }
    }
}

Need Your Help

How can I change the colors in a ggplot2 density plot?

r plot ggplot2

Summary: I want to choose the colors for a ggplot2() density distribution plot without losing the automatically generated legend.

Persist Sockets over page refresh and page changes

javascript node.js websocket socket.io

I have my NodeJS and Socket.IO server running perfectly, however I notice that a socket disconnect and reconnect occurs every time I refresh the browswer page or navigate to a different page.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.