I have a custom ImageView
where i can draw, zoom and paint points(coordinates).
I have a button "reset" which delete the coordinates i draw
BUT my imageView doesn't refresh when i click, it refresh after, when I touch the screen.
Gonna see some code
Here the onClick
of the buttons- btnRes
is the button i need help!
//this method is on the "Main extends Activity"
public void onClick(View v) {
switch(v.getId()){
case R.id.btnFin:
break;
case R.id.btnInv:
break;
case R.id.btnRes://start over
Imagen.listaPtos.clear();
//refreshing image
imagen.invalidate();//dont works
imagen.refreshDrawableState();//dont works neither
break;
}
}
Some thing about My class Imagen for understand an after the code
public class Imagen extends ImageView
static ArrayList <Marking> listaPtos = new ArrayList<Marking>();
some code from Imagen
@Override
public void onDraw(Canvas c){
Log.d("onDraw","pinta="+pinta);
c.drawBitmap(bitmap, matrix, paintFondo);
if(listaPtos!=null){
for(Marking mark:listaPtos){
c.drawBitmap(cruz, mark.x, mark.y, paintPuntos);
}
}
}
//for coordinates
class Marking{
int x;
int y;
Marking(int x, int y){
this.x = x;
this.y = y;
}
Marking(){}
int getX(){
return x;
}
int getY(){
return y;
}
void setX(int x){
this.x = x;
}
void setY(int y){
this.y = y;
}
}
any ideas?