How to return a value from a inner class?

前端 未结 5 537
抹茶落季
抹茶落季 2021-01-12 18:39

My code is here:

public static boolean showConfirmationDialog(Context context, String title, String dialogContent) {
        AlertDialog.Builder builder = ne         


        
5条回答
  •  孤城傲影
    2021-01-12 19:04

    You either need to set your return on an instance variable (not within a method) - but this may lead to concurrency issues, or use a "container" object. Pass-in, or use a "final" method variable, on which you can set the return value you want to return. However, I use the term "return" loosely, as at least in your example, this code won't immediately execute, so you really need to do the processing you're interested within the inner class instead.

提交回复
热议问题