android-image

how to select from resources randomly (R.drawable.xxxx)

删除回忆录丶 提交于 2019-12-03 10:58:38
问题 I want to display a random image from the bunch of images i have stored in res/drawable. The only technique that I know is to access a particular image if you know its resource id. Is there a way to access the images by using the filenames or something else (which can be constructed at runtime)? I want to randomly select an image at runtime. Any suggestions/ideas appreciated :) Thanks Chinmay 回答1: You can also access resources by name, which may be a viable approach to solving your problem if

Android uploading pictures to server in most efficient way

China☆狼群 提交于 2019-12-03 09:47:40
问题 I need to get images along with other data (very similar to email with attachements) to the server. I also need to do it in reliable manner so I can retry, etc on failure. Server is WCF REST server and I do lot of other communications with it(JSON) but just got this new requirement to upload images. Since I use JSON to post data to my server - I use GSON on Android side to serialize data. Here is how I got it implemented so far (everything else works this way but I just started with images)

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

一个人想着一个人 提交于 2019-12-03 09:13:47
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 Intent("com.android.camera.action.CROP"); // set data type to be sent intent.setType("image/*"); //

Retriving image from server to android app

∥☆過路亽.° 提交于 2019-12-03 09:00:21
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(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Bitmap

Android Blur View (Blur background behind the view)

一世执手 提交于 2019-12-03 07:38:12
问题 I am trying to make the bottom part of an Image blur for the view on top it like in the image. I tried blurring it using Rendenscript but I am not able to blur only the part behind the view. :( I have seen many libraries but almost all of them blur the entire image, but not a part of it. Also, an important part is that I am using this inside a ViewPager and hence needs to be fast and dynamic something like this in IOS which redraws itself the moment image behind it changes. Any help is

Video encode from sequence of images from java android [duplicate]

ε祈祈猫儿з 提交于 2019-12-03 03:58:46
问题 This question already has answers here : Encode a series of Images into a Video (4 answers) Closed 5 years ago . I would like to encode video from sequence of images with java only in my current android project. I mean without any use of external tools such as NDK. Also is there any availability of java libraries for encoding video from sequence of images ? 回答1: You can use a pure java library called JCodec ( http://jcodec.org ). It contains a primitive yet working H.264 ( AVC ) encoder and a

Video encode from sequence of images from java android [duplicate]

本秂侑毒 提交于 2019-12-02 17:21:29
This question already has an answer here: Encode a series of Images into a Video 4 answers I would like to encode video from sequence of images with java only in my current android project. I mean without any use of external tools such as NDK. Also is there any availability of java libraries for encoding video from sequence of images ? You can use a pure java library called JCodec ( http://jcodec.org ). It contains a primitive yet working H.264 ( AVC ) encoder and a fully functioning MP4 ( ISO BMF ) muxer. Here's a CORRECTED code sample that uses low-level API: public void imageToMP4

android bitmap isn't created from base64

心已入冬 提交于 2019-12-02 17:02:33
问题 I have an Android application which sends an image to a web service. I want to send the same photo back from the web service to Android. I made a test program to compare the base64 data that's sent from Android to the server and the base64 that's sent back from server to Android -- they are exactly equal. I want to use the base 64 string to create a bitmap, so I tried this: String image = client1.getBaseURI("restaurantFoods/OneFood/" + this.getID() + "/getImage"); byte[] decodedString =

Putting some indicator around the image in image move/resize/rotate operations

為{幸葍}努か 提交于 2019-12-02 15:35:12
I would like to Scale, Move, Resize Image. I would like to surround the image with Indicators which guide user what operation these indicators perform i.e. Moving, Rotating, Scaling. I've tried Scaling - but it only crops down. No chance to increase length and height of image. Rotate - achieved but via inserting manual degrees. That's not a good option in here. Moving - as I'm achieving drag on Api < 11. So little bit of difficult. Still no hope in here. Is there any library which can do me simple image edit [Move, Scale, Rotate]? You can use Matrix transaformation to achieve rotating, scaling

Animating all items in Animation-list

青春壹個敷衍的年華 提交于 2019-12-02 04:12:35
I have a list of images(around 10) in my "image_list.xml" under "animation-list" specified with "item". And I have made one "fade_in.xml" file for fade in effect of the imgaes. The code works fine without errors. The only problem I have is that the fade in effect appears in the first image but not in the other items of the image_list. Please tell me a way to make this possible so that all the images have fade in effect when they appear.My code is: image_list.xml <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot=