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: 
The `android.graphics.Path` class doesn't have such a method. The Canvas class does have a clipping region that can be set to a path, there is no way to test it against a point. You might try Canvas.quickReject, testing against a single point rectangle (or a 1x1 `Rect`). I don't know if that would really check against the path or just the enclosing rectangle, though.

The Region class clearly only keeps track of the containing rectangle. 

You might consider drawing each of your regions into an 8-bit alpha layer Bitmap with each `Path` filled in it's own 'color' value (make sure anti-aliasing is turned off in your `Paint`). This creates kind of a mask for each path filled with an index to the path that filled it. Then you could just use the pixel value as an index into your list of paths.

```
Bitmap lookup = Bitmap.createBitmap(width, height, Bitmap.Config.ALPHA_8);
//do this so that regions outside any path have a default
//path index of 255
lookup.eraseColor(0xFF000000);

Canvas canvas = new Canvas(lookup);
Paint paint = new Paint();

//these are defaults, you only need them if reusing a Paint
paint.setAntiAlias(false);
paint.setStyle(Paint.Style.FILL);

for(int i=0;i<paths.size();i++)
    {
    paint.setColor(i<<24); // use only alpha value for color 0xXX000000
    canvas.drawPath(paths.get(i), paint); 
    }

```

Then look up points,

```
int pathIndex = lookup.getPixel(x, y);
pathIndex >>>= 24;

```

Be sure to check for 255 (no path) if there are unfilled points.
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.