Hi there. I'm looking to develop a GPS like system for mobile devices (specifically MIDP compatible devices) with a custom map and my own code to draw the route. It won't necessarily be roads, but the inside of a building so I can't exactly utilize a service like Google Maps.

I can't seem to figure out the best logic for how it should determine where to draw to next. I have it set based on coordinates on the screen.. So it has a starting point and an end point. Now whats the best way to determine the points in between? Here was the logic I have been thinking of so far but hopefully you folks can help iron this out and point me in the right direction:

loop through a list of coordinates
test each for lowest distance between these coordinates and startx & starty
set lowest coordinates equal to nextx and nexty

if nextx, nexty = endx, endy
end -> set continueLoop to false

draw line from startx, starty to nextx, nexty
set lastx, lasty equal to nextx, nexty

otherwise inner loop while continueLoop = true
find the next set of coordinates with lowest distance from those to nextx, nexty
set nextx, nexty equal to those
if nextx, nexty = endx, endy
continueLoop = false
drawline from lastx, lasty to nextx, nexty
set nextx, nexty equal to lastx, lasty

I know this won't work because it doesn't account for going the opposite direction, so how could I refine this?

Not sure why you trying to re-invent the wheel since there is Google official JME application.
Also in this thread reply I pointed out resources to use if one want to interact with Google Maps directly and provide customize experience from their application

As mentioned in my post, it is a GPS for the inside of a building and I can't seem to find anything with google maps doing something like this.. Here's an overview map as an example of one of the buildings that will be part of this gps system:

http://www.netbreakers.com/map.gif

So as you see, it would be a gps showing how to get from one room to another room, something that I can't find any form of support for with google maps so I kind of have to reinvent the wheel unless there's an open source solution for this.