file_xyz
ようなものです
このコード:変更のImageButton DrawableのProgrametically
rand = new Random(System.currentTimeMillis());
x = rand.nextInt(3 - 0) + 0;
y = rand.nextInt(7 - 0) + 0;
z = rand.nextInt(9 - 0) + 0;
戻る "shape_" + X + Y + Z。
これはImageButtonのリソースを変更するために使用したい文字列を与えるので、これをどのように適用し、別々の時間にランダムに変更しますか? String pDrawableName = file_xyz
は、あなたが最初に(私は文字列の画像を呼び出します)描画可能フォルダのように正確なファイル名の文字列を作成する場合は、あなたが行うことができますあなたのイメージ名
このコードを書くとき、 'getResources()'は 'getClass()'だけを表示しません。@ rafsanahmad007 –
'getApplicationContext()。getResources()' – rafsanahmad007
は 'getApplicationContext() '@ rafsanahmad007 –