2011-09-22 11 views
0

タイトルには、私のalertDialogのボタンを作って、特定のURIに行きたいと思っていました。alertDialogボタンURIに移動

相続人とコードの抜粋:

    // Add a neutral button to the alert box AND assign a listener for said button... 
       alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener(){ 

        // click listener for box 
        public void onClick(DialogInterface arg0, int arg1){ 
         // Button was clicked!! 
         Toast.makeText(getApplicationContext(), "Dialog closed successfully!", Toast.LENGTH_LONG).show(); 
        } 
       }); 

       // Add a Forums button to take user to forums... 
       alertbox.setPositiveButton("Forums", new DialogInterface.OnClickListener(){ 

        //listener for button 
        public void onClick(DialogInterface arg0, int arg1){ 
         // Button Pressed! 
         Toast.makeText(getApplicationContext(), "Oops...this button is broke!", Toast.LENGTH_LONG).show(); 
        } 
       }); 
       // show it!!! 
       alertbox.show(); 

代わりにボタンが壊れていると言ってトーストの情報を表示することが、私は実際にそれがブラウザを起動し、URIにユーザを取るしたいと思います。

方法がある必要があります。

アイデア?

ありがとうございます! onClick()ハンドラ内

より多くのコードを更新しました。..

答えて

1

スタートの意図:完全に働いた

Intent intent = new Intent(); 
intent.setAction(Intent.ACTION_VIEW); 
intent.addCategory(Intent.CATEGORY_BROWSABLE); 
intent.setData(Uri.parse("http://website.com")); 
startActivity(intent); 
+0

!どうもありがとうございます! – death2all110

関連する問題