2012-02-02 5 views
1

ネット上で次のコードが見つかりました。私は最初の行について混乱しています。この行の目的は何ですか?"@SuppressWarnings(" unchecked ")"の目的は何ですか?

@SuppressWarnings("unchecked") 
private void showAlert(String title,String msg,final Class cls) 
{ 
    AlertDialog alertDialog = new AlertDialog.Builder(this).create(); 
    alertDialog.setTitle(title); 
    alertDialog.setMessage(msg); 
    alertDialog.setButton("OK", new DialogInterface.OnClickListener() { 
     public void onClick(DialogInterface dialog, int which) { 
      Intent samepage = new Intent(LoginActivity.this, 
        cls); 
      startActivity(samepage); 

     } 
    }); 
    alertDialog.setIcon(R.drawable.icon); 
    alertDialog.show(); 
} 

答えて

5

メソッド内のコードに未確認のジェネリック変換/キャストがあります。

したがって、@SuppressWarningsアノテーションを指定すると、コンパイラに認識されており、警告が表示されないので、IDEまたはコンパイルからの警告は表示されません。

関連する問題