AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("ALERTTILESTRING") .setMessage("alertNameString") .setCancelable(false) .setNegativeButton("Close",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); }
簡單的AlertDialog
將圖片id快速加到陣列
public void imgIdtoArray() { ArrayListIcon = new ArrayList<>(); //假設有50張圖 for (int i = 0; i < 50; i++) { //每張圖片的檔名 → no_1,no_2,no_3..... String name = "no_" + i; ballIcon.add(getResources() .getIdentifier(name, "drawable", getPackageName())); } }
訂閱:
文章 (Atom)