getActivity() where it is defined?

前端 未结 11 1964
温柔的废话
温柔的废话 2020-12-13 10:19

I\'m very new to android and I\'m following this example.

The code says we need to do these steps to get an dialog box:

AlertDialog.Builder builder =         


        
11条回答
  •  不思量自难忘°
    2020-12-13 10:41

    The constructor AlertDialog.Builder expects a Context parameter. Context is accessible from Activity, Service etc, since they all extend Context, and can be passed as this.

    The method getActivity() is declared as others have mentiond in the Fragment class.

提交回复
热议问题