0
나는 생성 된 인스턴스 이름이 모든 thime, 예를 들어 blocktitle1, blocktitle2, blocktitle3 등과 다를 때마다 필요합니다. 문자열 변수 "title"을 변경하는 코드를 작성했지만 새로운 비트 맵을 만드는 im이 "title"이라는 인스턴스를 "blocktitle2"가 아닌 인스턴스로 만들 때 "Title"이라는 단어를 넣습니다.인스턴스 제목이 매번 다른 bimap을 생성 하시겠습니까?
나는 누군가를 도울 것이 아주 유용 할 것이다.
List<Block> blocks = new LinkedList<Block>();
Random rnd = new Random(System.currentTimeMillis());
int randomx = 400;
public Block block;
int blocknum = 10;
String Title = "blocktitle" + blocknum;
public void generateBlocks(){
if(blocknum > 0){
int offset = rnd.nextInt(400) + 100; //500 is the maximum offset, this is a constant
x += offset; //ofset will be between 100 and 400
// i need the word below "block" to be recognised as a String variable "String Title"
block = new Block(BitmapFactory.decodeResource(getResources(), R.drawable.block), randomx, 200);
blocknum -= 1;
}
}