2013-11-03 3 views
4

내 앱에서 인앱 브라우저를 구현하고 싶습니다. AlertDialog.Builder 객체 내부에서 WebView를 사용하여 표시했습니다.AlertDialog.Builder가 표시된 후에 제목을 변경하는 방법은 무엇입니까?

final AlertDialog.Builder alert = new AlertDialog.Builder(context); 

지금 내가로드 된 페이지의 진행 상황을 보여주기 위해에 AlertDialog.Builder의 제목을 원했다, 문제가 있었다, 그래서 나는 onProgressChanged 함수를 재정의하고 다음과 같이 제목을 다시 시도 :

wv.setWebChromeClient(new WebChromeClient() { 
    public void onProgressChanged(WebView view, int progress) { 
     alert.setTitle("Loading..." + progress + "%"); 
    tv.setText("Loading..." + progress + "%"); 
    view.setVisibility(View.GONE); 
    if (progress == 100) { 
     alert.setTitle(title);// THIS DOES NOT HAVE ANY EFFECT 
     tv.setVisibility(View.GONE);//THIS IS "LOADING..." string, That I have written as make shift for the time being 
     view.setVisibility(View.VISIBLE);//This displays the WebView when it if loaded. 
    } 
} 
}); 

는 난에 AlertDialog.Builder 제목이 동적으로 변경하고 싶습니다.

답변

5

빌더는 처음으로 AlertDialog 인스턴스를 작성하는 데만 사용됩니다. 표시하기 전에 AlertDialog.create을 사용하여 대화 상자 인스턴스에 대한 핸들을 가져 오면 set the title이 표시 될 수 있습니다.

관련 문제