So i made an app that contains lots of drawables images.
It works prefectly in the debugger, but once i launch it in my phone, i'm getting an error "Invalid resource path specified" and i've no idea why.
Here's my code (i'm only using the main activity):
It works prefectly in the debugger, but once i launch it in my phone, i'm getting an error "Invalid resource path specified" and i've no idea why.
Here's my code (i'm only using the main activity):
Code:
package com.theg.dis4marta;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
[USER=1021285]@override[/USER]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void nextBtn(View v){
int min = 0;
int max = 17;
int minImg = 0;
int maxImg = 13;
int[] images = new int[14];
images[0] = R.drawable.kutze0;
images[1] = R.drawable.kutze1;
images[2] = R.drawable.kutze2;
images[3] = R.drawable.kutze3;
images[4] = R.drawable.kutze4;
images[5] = R.drawable.kutze5;
images[6] = R.drawable.kutze6;
images[7] = R.drawable.kutze7;
images[8] = R.drawable.kutze8;
images[9] = R.drawable.kutze9;
images[10] = R.drawable.kutze10;
images[11] = R.drawable.kutze11;
images[12] = R.drawable.kutze12;
images[13] = R.drawable.kutze13;
Random r = new Random();
int imageIndex = r.nextInt(maxImg - minImg + 1) + minImg;
ImageView myImage = (ImageView)findViewById(R.id.marisImage);
myImage.setImageResource(images[imageIndex]);
}
}