android-image

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);

Merge Two ColorMatrix or Apply two or more ColorMatrix simultaneously on Imageview

好久不见. 提交于 2019-12-05 03:15:54
问题 I am changing Brightness, Contrast, Saturation and Hue of an ImageView. I have searched lot on it. I got some code which works with ColorMatrix. [1.] For Brightness ColorMatrix is some thing like float brightness = (-50F * 1.5F); ColorMatrix cmB = new ColorMatrix(); cmB.set(new float[] { 1, 0, 0, 0, brightness, 0, 1, 0, 0,brightness, 0, 0, 1, 0, brightness, 0, 0, 0, 1, 0 }); myImageView.setColorFilter(new ColorMatrixColorFilter(cmB)); which works Properly. [2.] For Contrast ColorMatrix is

Syncing photos in Android gallery

北慕城南 提交于 2019-12-05 03:08:34
问题 I've seen a few apps that can sync photos with the Android gallery (such as Picasa), and I'm wanting to create something similar myself, where I would have a remote server with the photos and the users would be able to access these from within separate albums in the gallery (as the aforementioned apps). However, I do not know how this could be achieved, or even where do begin. Does anyone know how I should go about doing this? My Facebook photos in the synced stock gallery app on my Galaxy

Android File Provider Illegal Argument Exception

元气小坏坏 提交于 2019-12-04 23:35:44
I am using file provider to save photo to a given destination. I get: java.lang.IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data while trying to open activity to capture image from camera. My manifest.xml file: <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.example" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/paths" /> </provider> My paths.xml file: <paths xmlns:android="http://schemas.android.com/apk/res/android">

Detect if resolution is too high on Android Lollipop

…衆ロ難τιáo~ 提交于 2019-12-04 20:37:11
I have to display some pictures in an ImageView. Some of them may have a resolution too high that gives me W/OpenGLRenderer﹕ Bitmap too large to be uploaded into a texture (3744x5616, max=4096x4096) I used this method to detect this situation: public boolean isResTooHigh() { int[] maxSize = new int[1]; GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSize, 0); return (maxSize[0] < width) || (maxSize[0] < height); } where width and height are provided by the source of the pictures. But now on my Nexus 4 running Lollipop and my emulators, maxSize[0] is always 0. So, how do I detect this problem

How to convert image to string in Android?

允我心安 提交于 2019-12-04 20:18:12
It's my MySql DB Its encoding:- public String convertBitmapToString(Bitmap bmp) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); //compress to which format you want. byte[] byte_arr = stream.toByteArray(); String imageStr = Base64.encodeToString(byte_arr, 1); return imageStr; } This is decoding:- String img=o.toString(); byte[] imageAsBytes = Base64.decode(img.getBytes(), Base64.DEFAULT); imageView.setImageBitmap(BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length)); Thank you. It could be done by private String

Retriving image from server to android app

一个人想着一个人 提交于 2019-12-04 15:43:28
问题 package com.sample.downloadImage; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import org.apache.http.util.ByteArrayBuffer; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.widget.ImageView; public class downloadImage extends Activity { @Override public void onCreate

How Can I Get Thumbnails For Picasa Images Selected From The Gallery?

大城市里の小女人 提交于 2019-12-04 15:19:13
I'm working on an application where the user is able to select files, either a new image from the camera, an image from the gallery, or a plain old file. It then shows an icon and the name for the selected item. I have this working with one exception. The gallery application integrates picasaweb pictures. If the user selects a picture from a picasa album, I'm not able to get a thumbnail for it. I'm using the MediaStore.Images.Thumbnails.getThumbnail() method, and it works for other images in the gallery just fine, but for the picasaweb files, I get, regardless of what "kind" of thumbnail I

How to save cropped image in android instead of returning cropping data?

若如初见. 提交于 2019-12-04 14:42:05
问题 I have an application where I can let the user choose a gallery image or take a picture with camera, then after that I give him the option to crop it. Now when the user crops the image the Gallery cropper returns ByteArray of the cropped part, is it possible to pass a parameter asking the Gallery cropper to save the output to file (Just like the case when I start a intent to capture and image in the camer) e.g.: This is the code of cropping that I Use: // Initialize intent Intent intent = new

How to know if two images are intersect while one image moving in android?

偶尔善良 提交于 2019-12-04 08:27:57
In my application, i am moving image around the screen by using onTouchListener . I have another two images in the same view. My problem is that, when the moving image, touches any of the other images, i need to perform a certain action (that means if images are intersected, then do something). How can this be achieved?.Please help me asap Thanks in Advance. You should be able to use Rect.intersects(Rect, Rect) , like this example: Rect myViewRect = new Rect(); myView.getHitRect(myViewRect); Rect otherViewRect1 = new Rect(); otherView1.getHitRect(otherViewRect1); Rect otherViewRect2 = new Rect