1
I have the Stickerbtn.java with the following code:
public class StickerBtn extends View {
private Bitmap mControllerBitmap
private void init() {
mControllerBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_refreshing);
mControllerWidth = mControllerBitmap.getWidth();
mControllerHeight = mControllerBitmap.getHeight();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (stickers.size() <= 0) {
return;
}
for (int i = 0; i < stickers.size(); i++) {
stickers.get(i).getmMatrix().mapPoints(stickers.get(i).getMapPointsDst(), stickers.get(i).getMapPointsSrc());
canvas.drawBitmap(stickers.get(i).getBitmap(), stickers.get(i).getmMatrix(), null);
if (stickers.get(i).isFocusable()) {
canvas.drawBitmap(mControllerBitmap, stickers.get(i).getMapPointsDst()[4] - mControllerWidth / 2, stickers.get(i).getMapPointsDst()[5] - mControllerHeight / 2, null);
canvas.drawBitmap(mDeleteBitmap, stickers.get(i).getMapPointsDst()[0] - mDeleteWidth / 2, stickers.get(i).getMapPointsDst()[1] - mDeleteHeight / 2, null);
}
}
}
And I have the Mainactivity.java with the following:
imgSave = (ImageView) findViewById(R.id.imgSave);
imgSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
...
}
What I have to put in place three points for when the user presses the save image it hides or removes the R.drawable.ic_refreshing?
I’ve tried the following, but the mistake, because it’s in another class:
mControllerBitmap.setVisibility(View.GONE);
Can someone help me?
Tries mControllerBitmap.setVisibility(View.INVISIBLE);
– D. Pinheiro
Do you want to hide the image from the button but keeping the button? What do you mean by "save it"?
– ramaral
I want you to press "R.id.imgSave" to remove "R.drawable.ic_refreshing" from the screen. When I try setvisibility, it says the following: Cannot resolveSymbol 'mControllerBitmap'.
– Stéfano
R.drawable.ic_refreshing is used inside Stickerbtn. Where/how do you use Stickerbtn? It’s harder to figure out what you want than eventually to solve the problem.
– ramaral
What code do I have to use on mainactivity to manipulate the icon that is in the project’s drawable folder and is used in another class.
– Stéfano
Just this is not enough, there are several possibilities. Where/how do you use Stickerbtn? Just want to hide the R.drawable.ic_refreshing and keep the Stickerbtn view?
– ramaral
Stickerbtn is created to stand next to an image that changes in size when you press the R.drawable.ic_refreshing button. I just want to hide R.drawable.ic_refreshing when the person is saving that image.
– Stéfano
Stickerbtn and R.drawable.ic_refreshing are not the same thing?
– ramaral
R.drawable.ic_refreshing is one of the buttons that make up Stickerbtn. When the person selects the image they want to edit Stickerbtn, it creates several buttons around the image with editing options. One of these buttons is R.drawable.ic_refreshing, which I want to make it disappear.
– Stéfano