FATAL EXCEPTION: Animation Thread
in
Android Processing
•
6 months ago
hi everyone~~~need help here!!!
i'm working on an android project and drawing the main interface.
code following:
Jieqi[] j=new Jieqi[24];
int select=0;
int enter=-1;
PFont font;
PImage bg;
PImage ramp;
PImage spring, summer, autumn, winter;
Integrator transx, transy;
Button next;
Button pre;
void setup() {
transx=new Integrator();
transy=new Integrator();
font=loadFont("MicrosoftYaHei-18.vlw");
textFont(font, 18);
bg=loadImage("bg.png");
ramp=loadImage("ramp.png");
spring=loadImage("spring.png");
summer=loadImage("summer.png");
autumn=loadImage("autumn.png");
winter=loadImage("winter.png");
size(1280, 800);
background(ramp);
pre=new Button(displayWidth-50, 60, 24, "pre.png");
next=new Button(displayWidth-50, 120, 24, "next.png");
for (int i=0;i<=j.length-1;i++) {
String s;
if (i<=5) {
s="spring";
}
else {
if (i<=11) {
s="summer";
}
else {
if (i<=17) {
s="autumn";
}
else {
s="winter";
}
}
}
String labelName="label_"+nf(i, 2)+".png";
String iconName="icon_"+nf(i, 2)+".png";
j[i]=new Jieqi(i, position[2*i], position[2*i+1], s, labelName, iconName, name[i]);
}
transx.set(j[select].mapx);
transy.set(j[select].mapy);
}
void draw() {
background(ramp);
transx.update();
transy.update();
pushMatrix();
translate(transx.value, transy.value);
image(bg, 0, 0);
selectSeasonImage(select);
for (int i=0;i<=j.length-1;i++) {
if (i!=select) {
j[i].setScreenPosition(int(transx.value), int(transy.value));
j[i].show(select);
}
}
j[select].show(select);
popMatrix();
pre.over();
pre.show();
next.over();
next.show();
if (enter>=0) {
fill(0);
text(j[enter].name,50,50);
noFill();
}
}
void mouseClicked() {
for (int i=0;i<=j.length-1;i++) {
j[i].checkClick();
}
if (pre.over==true) {
select=(select-1+24)%24;
j[select].setmap();
}
if (next.over==true) {
select=(select+1+24)%24;
j[select].setmap();
}
}
void selectSeasonImage(int select) {
if (select<=5) {
image(spring, 0, 0);
}
else {
if (select<=11) {
image(summer, 0, 0);
}
else {
if (select<=17) {
image(autumn, 0, 0);
}
else {
image(winter, 0, 0);
}
}
}
}
void mouseDragged() {
float dx=mouseX-pmouseX;
float dy=mouseY-pmouseY;
transx.noTarget();
transy.noTarget();
transx.set(transx.value+dx);
transy.set(transy.value+dy);
}
the Jieqi class contains png images in the size 36*36 and 500*98
the ramp image is 1280*800
the bg,spring,summer.autumn,winter images are all 2848*3161
I get the project run on my sumsung note 8010,but processing shows FATAL EXCEPTION: Animation Thread and the program shutdown on device.
Question:are the images too large and cause the problem?? If so,what should i do next??
need quick feedback
THX
1