Question: got the following problem.   
 i need the following just to be drag/dropable in the green area.   

should be something like that:   

```
limit($(this).parent());

```

but thats not working, im using this for dnd:

```
$('#dragThis').draggable({
drag: function () {

    var offset = $(this).offset();
    var xPos = Math.abs(offset.left);
    var yPos = Math.abs(offset.top);
    $('#posX').val('x: ' + xPos);
    $('#posY').val('y: ' + yPos);
},
stop: function (event, ui) {

    // Show dropped position.
    var Stoppos = $(this).position();
    var left = Math.abs(Stoppos.left);
    var top = Math.abs(Stoppos.top);
    $('#posX').val('x: ' + left);
    $('#posY').val('y: ' + top);
}

```

});

hope someone can help me with that ;) thx so far

<http://jsfiddle.net/DGbT3/1850/>

///////////////  

Update - getting correct x/y Position and just allow inside green area:   

<http://jsfiddle.net/DGbT3/1858/>

Answer: 
The only way that I can see that you can get a `NullPointerException` on line 116 of [`IntentService.java`](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/app/IntentService.java) would be if your service overrides `onCreate()` and does not chain to the superclass.
From your requirement i feel you need to use a pending intent along with the Alarm manager. A sample of the same is shown below:

```
//Creating a PendingIntent
Intent intent = new Intent(MainActivity.this, MyService.class);
PendingIntent pendingIntent = PendingIntent.getService(
MainActivity.this, UNIQUE_ID_RANDOM, intent, 0);
//Creating an AlarmManager and setting the pendingIntent to him
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()
+ (5 * 1000), pendingIntent);
Toast.makeText(MainActivity.this, "Alarm set in " + 5 + " seconds",
Toast.LENGTH_SHORT).show();

```

Now inside the service you start after say 5 seconds, you can put your above code and give a try. Below is the sample:

```
public class MyService extends Service{

@Override
public void onCreate() {
    super.onCreate();

}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {

    //Your database opening code should come here. But take care of the syntax related constructs.
    return START_NOT_STICKY;
 }

@Override
public IBinder onBind(Intent arg0) {
    // TODO Auto-generated method stub
    return null;
}

}

```

I hope this helps you.

Regards,

Zax