0
I have the following class:
public class TesteMultiImage extends ActionBarActivity {
Uri URI;
String ImagePath;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_teste_multi_image);
button = (Button)findViewById(R.id.button3);
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy_HHmm");
final String currentDateandTime = sdf.format(new Date());
final RelativeLayout rl = (RelativeLayout)findViewById(R.id.rl);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
rl.buildDrawingCache();
Bitmap bmap = rl.getDrawingCache();
ImagePath = MediaStore.Images.Media.insertImage(
getContentResolver(),
bmap,
"banner" + currentDateandTime,
"banner"
);
URI = Uri.parse(ImagePath);
Toast.makeText(getApplicationContext(), "Imagem Salva", Toast.LENGTH_LONG).show();
}
});
}
}
It saves my relative layout as a bitmap. But she saves with a black background, and I need you to save with a transparent background. When trying to configure :
bmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
It doesn’t work. How to solve?
I don’t know what you mean.
– Marceloawq