【发布时间】:2013-09-14 16:01:24
【问题描述】:
有什么方法可以从内部函数返回外部函数的值(或只是 return;)?
我的问题类似于这个问题: Breaking out of nested loops in Java,但不同的是,在这个问题中,提问者询问了在嵌套循环中打破外循环的问题,而我询问了在嵌套函数中返回外部函数的问题。
public void outerFunction ()
{
runOnUiThread (new Runnable()
{
@Override
public void run ()
{
// Here i want to return;, so the function will not continue after runOnUiThread
}
});
// Code here should not run.
}
【问题讨论】:
-
您正在查看的是,作为方法调用一部分的烦人线程实例,而不是函数/方法中的函数/方法。
标签: java android function methods nested