android-bitmap

How to get path of a captured image in android

南楼画角 提交于 2019-12-05 04:08:28
问题 I am working on an android application. It has a functionality that captured image should display on screen and I need to get that image path, so that I can send that image to server. I am able to display image on screen, but unable to get absolute image path. I am getting path like: content://media/external/images/media/1220 content://media/external/images/media/1221 How can I get actual image path? Here is my code: mintent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

Pinch zooming on an image in Xamarin

。_饼干妹妹 提交于 2019-12-05 00:06:20
问题 In Xamarin , what is the best way to enable pinch zooming for an image? Currently I have just an ImageView that has a Bitmap image as an image. I have done some research, and I have found a few examples where people have used some other libraries but would like some advice on the best way to enable pinch zooming on an image before I start writing this code. So, what is the best way to enable pinch zooming on an image in Android , specifically Xamarin ? Thank in advance 回答1: You can get

Can't catch Java (Android) Exception with try-catch , createBitmap

痞子三分冷 提交于 2019-12-04 21:58:39
I have a part of code, i use this code four times, but the the sixth time, my application crash , i don't get any Exception or error code. The code is: Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); I try to use: try{ Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); }catch (Exception e){ e.printStackTrace(); e.getMessage(); }catch (OutOfMemoryError o){ o.printStackTrace(); o.getMessage(); }catch (AssertionError a){ a.printStackTrace(); a.getMessage(); } catch ( Throwable t ){ t.printStackTrace(); t.getMessage(); } But

Creating a bitmap of a drawn square in android opengl es 2.0

别来无恙 提交于 2019-12-04 21:44:36
I have drawn a square using opengl es 2.0 and now i want to create a bitmap of that drawn square. Can anyone please guide me on how to do that? Please let me know if my question is not clear. Thanks It is done using glReadPixels(). This is slow, but is the only method available with OpenGL ES 2.0 on Android. In Java: Bitmap buttonBitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888); ByteBuffer byteBuffer = ByteBuffer.allocateDirect(mWidth * mHeight * 4); GLES20.glReadPixels(0, 0, mWidth, mHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, byteBuffer); buttonBitmap

Gray out fragment in background

孤者浪人 提交于 2019-12-04 21:02:46
I have one main Fragment which is in the background when the second Fragment gets called with getFragmentManager().beginTransaction().add . Right now the user can see the main Fragment behind the second Fragment like it should be. But i want it to be like in a grayed look. When the Second Fragment gets called, the main Fragment should gray out. Im not sure what to google (have tried a lot of keywords) to describe this. My idea was to take a screenshot of the main fragment (bitmap) and make it gray. Is this the right direction? Just put a View in between the Fragments so that it overlays the

How to make Picasso load images faster?

大憨熊 提交于 2019-12-04 19:09:37
I use Picasso (image downloading library for Android). Picasso website I charge my image like this: Picasso.get().load("http://i.imgur.com/myImage.png").into(imageView); But, if myImage.png is too big, the download become slow. (With bad internet connection of course) How to make Picasso load images faster? Can I just make the quality lower by Picasso? Or can I charge them "early" a few seconds before using them? Note that I cannot touch the file myImage.png --------------------- EDIT Any idea how to charge an image "early"? Should I use invisible view and load image into it, then use the same

Prevent bitmap too large to be uploaded into a texture android

会有一股神秘感。 提交于 2019-12-04 02:48:45
问题 I need to display original image in full screen in gallery form. For thumb it will be work perfectly and when I try to display that image in full screen with original source it will not be able to display. In most cases if the image resolution is greater then 2000 then it will display error bitmap too large to be uploaded into a texture android . I want to prevent this, I have search google but not getting any answer regarding this. 回答1: I came across the same problem and came up with a one

Get Bitmap from TextureView efficiently

五迷三道 提交于 2019-12-04 01:22:28
I am trying to get each frame from a TextureView , unfortunately trying: textureView.getBitmap(); Results in slow performance is there a faster way to obtain a bitmap. Is it better to use the NDK instead? Looking for actual examples A TextureView receives frames on a SurfaceTexture, which takes frames sent to its Surface and converts them to a GLES texture. To get the pixel data out, the texture must be rendered to a framebuffer, then read out with glReadPixels() . The pixel data can then be wrapped with a Bitmap object (which may or may not involve copying the pixel data). Using the NDK isn't

How to save objects previously drawn to the Canvas on a redraw?

大城市里の小女人 提交于 2019-12-03 21:29:54
Every time a SurfaceView is redrawn, things that were previously drawn are erased. How do I save their state so that my loop will add new objects to the screen without erasing the old ones? Draw with a Bitmap : Bitmap mDrawBitmap; Canvas mBitmapCanvas; Paint mDrawPaint = new Paint(); @Override public void onDraw(Canvas canvas) { if (mDrawBitmap == null) { mDrawBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); mBitmapCanvas = new Canvas(mDrawBitmap); } // draw on the btimapCanvas //... and more mBitmapCanvas.drawWhatever(...); // after drawing with the bitmapcanvas

How to get path of a captured image in android

↘锁芯ラ 提交于 2019-12-03 21:05:51
I am working on an android application. It has a functionality that captured image should display on screen and I need to get that image path, so that I can send that image to server. I am able to display image on screen, but unable to get absolute image path. I am getting path like: content://media/external/images/media/1220 content://media/external/images/media/1221 How can I get actual image path? Here is my code: mintent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); mintent.putExtra(MediaStore.EXTRA_OUTPUT, MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString());