android-image

Setting image from url to ImageView with AsynchTask

半世苍凉 提交于 2019-12-25 23:08:51
问题 I have an image on my website, that I want to set on my ImageView. Do to that I needed to use an asynch task. I'm doing it like below. But new getThumbnail().execute(stringThumbnail); is throwing me the error getThumbnail cannot be resolved to a type . What am I doing wrong in here? final ImageView thumbnail = (ImageView) findViewById(R.id.btnThumbnail); String stringThumbnail = "myImage.jpg"; new getThumbnail().execute(stringThumbnail); class getThumbnail extends AsyncTask<String, Void, Void

If I have an image 50dp wide/tall in xhdpi, what size do I make for mdpi?

て烟熏妆下的殇ゞ 提交于 2019-12-25 08:17:20
问题 I am working with a graphic designer at the moment who is trying to verify what sizes images I am currently using in my app so he can create new images in the right size for all resolution modes (designing the image at the smallest size and then scaling it for the other modes). In my app, I am emulating a device that is 720 x 1280: xhdpi , and on this device, an ImageView is set to size 50dp x 50 dp . Is it correct to say 50 dp xhdpi -> 25 dp mdpi? 100px? Or 50px? What exactly? What is the

Load large bitmap from url and resize it

我只是一个虾纸丫 提交于 2019-12-25 04:16:31
问题 I want load huge image from url and show on my device. I read this post for doing this. In that example they use native drawable but I want get image from server. I am using this code private void getBitmap(ImageView imageView,final String url){ mBitmapOptions = new BitmapFactory.Options(); mBitmapOptions.inJustDecodeBounds = true; URL mUrl = null; InputStream is= null; try { mUrl = new URL(url); is = mUrl.openStream(); } catch (MalformedURLException e) { e.printStackTrace(); } catch

ImageView - implementing gestures (pinch zoom, double tap) compatible with ViewPager (just like Android Gallery)

帅比萌擦擦* 提交于 2019-12-25 02:16:02
问题 I was looking for an effective way to implement gestures option to ImageView with ViewPager. I tried some examples, but they are not working well (e.g. pinch zoom actually is not zooming where I want to). In my app I need pinch zooming, double tap zoom and draging zoomed image. What is the fastest and easiest way to make it all working well? 回答1: you can try this open sources project: https://github.com/jasonpolites/gesture-imageview 来源: https://stackoverflow.com/questions/12517306/imageview

Changing stroke color changes previous strokes color

本小妞迷上赌 提交于 2019-12-24 16:28:52
问题 I'm trying to make an android kids coloring book app, and when I'm firstly drawing with one color its ok, but when I change the brush color, all the previous coloring changes color as well. What can be the solution of this problem? Starting to paint with one color: After changing the color and making another stroke this is what's happens Here is my SignatureView class that is for this drawing surface: public class SignatureView extends View { private float STROKE_WIDTH = 5; /** Need to track

Why the icons / images looks blur (not clear) on tablet , but looks fine on phone in android?

♀尐吖头ヾ 提交于 2019-12-24 12:34:00
问题 I was working on android app based on phone. However, recently the app need to support the tablet. The design was based on 1920 * 1080, I put all images/ icons into the xxhdpi folder and for lower resolution I just let android to help me rescale it. The problem is , it works well on phone(1280 * 800 5"), but when I use tablet to check it (say , galaxy tab 2 which resolution is only 1280 * 800 10.1" and 1024 * 600) but it looks like very blur . How to fix it ? Thanks for helping. Added

Problems uploading base64 images to server by httpPost

…衆ロ難τιáo~ 提交于 2019-12-24 11:04:42
问题 I am prototyping an application where I send the whole content of the local SQLite database to a remote MySQL database using JSON and HttpPost. Everything works fine for text data. Now I added images to the party and I though I could add the images as base64 strings to the JSON I am sending away. My images are 800 x 600 pixels, more or less 500kb in size each. If I paste the JSON generated by my app manually to a web page, it is fine, I get my images and everything else. Using the app

Android L - Take flash image with autofocus using Camera2 api

微笑、不失礼 提交于 2019-12-24 10:35:29
问题 Following camera2basic guide on Android L preview page, I am able to capture normal images, i.e. without flash or using auto-focus mechanism (I rely on passive focus) However, I would like to take a flash image. The documentation states before taking flash image, I should call android.control.aePrecaptureTrigger to determine correct exposure. My question: How can I call AE Precapture trigger, wait for it to complete and then take the image using capture(CaptureRequest, CameraCaptureSession

Android - Loading Image Url and Displaying in ImageView

大兔子大兔子 提交于 2019-12-24 03:15:59
问题 I have this code to load an image. The server is secured. I got a response: 200 which means okay. Then also the right url is to be loaded. The problem is when i run my app, the image wont be loaded. try { Bitmap bitmap=null; URL imageUrl = new URL(url); String userPass = username+":"+password; String encode = Base64.encodeToString(userPass.getBytes(), Base64.DEFAULT); HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection(); conn.setRequestProperty("Authorization", "Basic " +

Serialize image to a String

随声附和 提交于 2019-12-24 03:07:26
问题 Good friends of the forum. I've been searching a lot, and I could not find how to serialize an image and pass it to a String in android. as might be not so, If someone knows and wants to inform me I would appreciate very much!. 回答1: Although the java.awt.Image class is not (does not implement) java.io.Serializable , javax.swing.ImageIcon is. Because of this, you can serialize it as follows: ImageIcon myImage; // declare somewhere ByteArrayOutputStream baos = new ByteArrayOutputStream();