The onCreate method runs on the main (UI) thread and your posting a Runnable to run on the main (UI) thread.
In that thread you have a loop with
while (p_running)
so this while loop is running on the UI thread in an infinite loop.
You could simply move that code to another Thread like so
Thread t = new Thread (){
@Override
public void run(){
while (p_running){
runOnUiThread(new Runnable(){
@Override
public void run(){
mFrame.setPadding(x,y,0,0);
}
});
}
}
});
t.start();
but there are still issues with that as you are constantly posting new Runnables to the UI thread which will probably result in very poor UI response