DialogInterface
  private void openNewGameDialog() {

        new AlertDialog.Builder(this)

        .setItems(R.array.SNS , new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dia, int i) {
                       startGame(i);
                       }
        })
        .show();
   
     }
   
     private void startGame(int i){
            Log.d("sado", "clicked on"+i);
     }

array.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
      <array name="SNS">
            <item>트위터</item>
            <item>페이스북</item>
            <item>미투데이</item>
            <item>카카오톡</item>
      </array>
</resources>
Posted by 예배하는 프로그래머