Question: Function socialbookmarksTableData(data) is called by another function to generate the content of a table -- data is a JSON object. Inside the function i call 2 other functions that use getJSON and POST (with json as a return object) to get some data. The problem is: though the functions execute correctly i get undefined value for the 2 variables (bookmarkingSites, bookmarkCategories). Help with a solution please. 

```
    function socialbookmarksGetBookmarkCategories(bookmarkID)
    {
        var toReturn = '';
        $.post("php/socialbookmark-get-bookmark-categories.php",{
            bookmarkID: bookmarkID
        },function(data){
            $.each(data,function(i,categID){
                toReturn += '<option value ="' + data[i].categID + '">' + data[i].categName + '</option>';
            })
            return toReturn;
        },"JSON");
    }

    function socialbookmarksGetBookmarkSites()
    {
        var bookmarkingSites = '';
        $.getJSON("php/socialbookmark-get-bookmarking-sites.php",function(bookmarks){

            for(var i = 0; i < bookmarks.length; i++){
                //alert( bookmarks[i].id);
                bookmarkingSites += '<option value = "' + bookmarks[i].id + '">' + bookmarks[i].title + '</option>';
            }
            return bookmarkingSites;
        });
    }
    function socialbookmarksTableData(data)
    {
        var toAppend = '';
        var bookmarkingSites = socialbookmarksGetBookmarkSites();

        $.each(data.results, function(i, id){

            var bookmarkCategories = socialbookmarksGetBookmarkCategories(data.results[i].bookmarkID);
    //rest of the code is not important
        });
    $("#searchTable tbody").append(toAppend);
}

```

Answer: 
Here is what I did and it seems to work:

```
RectF rectF = new RectF();
path.computeBounds(rectF, true);
region = new Region();
region.setPath(path, new Region((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom));

```

Now you can use the `region.contains(x,y)` method.

```
Point point = new Point();
mapView.getProjection().toPixels(geoPoint, point);

if (region.contains(point.x, point.y)) {
  // Within the path.
}

```

\*\* Update on 6/7/2010 \*\*
The region.setPath method will cause my app to crash (no warning message) if the rectF is too large. Here is my solution:

```
// Get the screen rect.  If this intersects with the path's rect
// then lets display this zone.  The rectF will become the 
// intersection of the two rects.  This will decrease the size therefor no more crashes.
Rect drawableRect = new Rect();
mapView.getDrawingRect(drawableRect);

if (rectF.intersects(drawableRect.left, drawableRect.top, drawableRect.right, drawableRect.bottom)) {
   // ... Display Zone.
}

```
I know I'm a bit late to the party, but I would solve this problem by thinking about it like determining whether or not a point is in a polygon.

<http://en.wikipedia.org/wiki/Point_in_polygon>

The math computes more slowly when you're looking at Bezier splines instead of line segments, but drawing a ray from the point still works.