Questions tagged [createbitmap]
13 questions
5
votes
3 answers
Bitmap.CreateBitmap return null in JUnit Testing Android Studio
I need to create a fake bitmap image for testing (JUnit Test) my personal add and get methods of a custom LinkedList but the Bitmap.createBitmap return the error:
java.lang.RuntimeException: Method createBitmap in android.graphics.Bitmap not…

Matteo Mascotto
- 51
- 1
- 4
1
vote
1 answer
Why I obtain a black background when I create a new Bitmap in this way? How can I obtain a transparent backround?
I am pretty new in Android development and I have the following problem.
I have implement this code that draw a Bitmap using Canvas (it draw 5 icons one beside each other), so this is my code:
@Override
protected void onCreate(Bundle…

AndreaNobili
- 40,955
- 107
- 324
- 596
0
votes
1 answer
onDraw - How to scale bitmap without creating a new bitmap?
I am making a custom view and I am overriding its onDraw method. In the onDraw method I am scaling a Bitmap, with the createBitmap function. This works perfectly fine. However, Android Studio gives a warning when doing this, namely: avoid object…

t.r.hogenkamp
- 73
- 2
- 7
0
votes
0 answers
c++ compiler returning undefined reference when referencing "CreateBitmap()"
I am very new to c++ and I cant seem to get this code to work:
#include
#include
using namespace std;
int main() {
HBITMAP hbm = CreateBitmap(100, 100, 1, 24, NULL);
return 0;
}
The console outputs: "undefined reference…

Dusty Berkley
- 32
- 1
- 6
0
votes
1 answer
How to cut status bar OR actionbar from a bitmap?
bitmap?.let {
cropimg = Bitmap.createBitmap(
it,
0,
56+28,//each mobile has different height of actionbar and status bar
…

Mohammad Taqi Velani
- 61
- 1
- 5
0
votes
1 answer
Android: Create image from two bitmaps, bitmap under bitmap
What I want: Create image with two bitmap, under first bitmap put second bitmap.
At this moment I use this code
public static Bitmap combineImages(Bitmap background, Bitmap foreground, float disFromTheTopPercent) {
int width =…

Developer534255
- 121
- 1
- 9
0
votes
1 answer
Cropping image using createbitmap and a view
I have a view that can be dragged anywhere on the screen, so if a user drags it on the screen. Then everything within the view will only be cropped, how would I be able to achieve that?
I have been able to crop by just calculating which part to…
user6150841
0
votes
1 answer
Crop Bitmap image to custom sguare
Image sample
I have this method written for cropping my image, but HEIGHT dimension doesnt work on the cropping, only weight is done right. I cant find the issue. I want to use my screen width and height as a dynamic width and height.
public Bitmap…

Купувај Онлајн
- 33
- 1
- 7
0
votes
2 answers
Android out of memory error while rotate a bitmap
I am currently working on a project in which one I would like to rotate a bitmap.
The first time, I create my bitmap with the following code :
myBitmap = BitmapFactory.decodeResource(getResources(), drawableResource);
Then I rotate the bitmap using…

rolandl
- 1,769
- 1
- 25
- 48
0
votes
1 answer
createBitmap simple crop android
Code im using:
Bitmap cropImg = Bitmap.createBitmap(bitmap, cropW, cropH, newWidth, newHeight);
Not a java programmer but as i understand it everything is from top left.
my dimensions are
cropW: '696',
cropH: '72',
newWidth:…

Roger Large
- 105
- 12
0
votes
1 answer
Resize a bitmap in android - OutOfMemoryError exception
I try to re-size a bitmap, but sometimes i got an OutOfMemoryError crash.
Think that this line is the problem:
Bitmap.createBitmap(bm, 0, 0, width, height,
matrix, false);
this is the function:
public static Bitmap…

user3737110
- 1
- 1
0
votes
1 answer
Android Drawable Marker with Bitmap Text Overlay too Small
I am creating a Marker with text but the text is showing only 3 characters and very small and it is right of the bit map image. I want the text to go across the middle of the icon and it big font. I manually increased setFontsize to larger size did…

user914425
- 16,303
- 4
- 30
- 41
-3
votes
1 answer
joshdholtz CropImageView createbitmap java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
For cropping images I am using CropImageView of joshholtz (https://github.com/joshdholtz/CropImageView). But I am getting IllegalArgumentException exception (saying: x + width must be <= bitmap.width()) at CreateBitmap function at crop function in…

Bahruz Jabiyev
- 3
- 2