android-image

Crop and keep the size of an image android

爱⌒轻易说出口 提交于 2019-12-13 19:49:35
问题 This is a really hard question to explain in words (well it is for me anyway). I need to be able to take an image (bitmap) and crop the image down to a certain size in the centre of the screen but keeping the size of the image the same. Hopefully the picture below can explain what I mean: So the image as a whole is cropped down to the square in the middle but is not stretched across the screen and remains in the centre, so basically removing the pointless part of the image but keeping to co

What is size of thumbnail returned by ACTION_IMAGE_CAPTURE intent

梦想与她 提交于 2019-12-13 16:06:58
问题 I'm using the standard camera intent to take a photo: Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(takePictureIntent, actionCode); And then in onActivityResult () Bundle extras = intent.getExtras(); Bitmap imageBitmap = (Bitmap) extras.get("data"); mImageView.setImageBitmap(imageBitmap); Bitmap is a thumbnail. That's great - I don't need full size images. Before user can take a photo, I display a default thumbnail that they can click and that

How to specify the number of retries using Glide for Android for loading images?

自闭症网瘾萝莉.ら 提交于 2019-12-13 13:12:50
问题 I'm using the glide library for my Android app. I would like to tell it to retry getting the image X times ( maybe with exponential backoff! ), before giving up and showing the error placeholder image. Any idea how to do this? (I'm using the Volley integration btw). 回答1: Use your own ResourceDecoder. I'm loading local files only and handle the retry count in decode() . If you use another model just change to the appropriate interface. Example for Glide 4.0.0-SNAPSHOT. The custom

Android: are images of the same size rendered differently if placed in different drawable folders?

情到浓时终转凉″ 提交于 2019-12-13 08:47:23
问题 does an image of the same pixel dimensions in drawable-hdpi render the same or different in drawable-mdpi folder? 回答1: Yes, they will render differently. Each time you provide higher density images, those images will need to have a larger size in pixels to account for the density but appear at the same size in dp. To convert dp to pixels, multiply a value in dp by the device's density multiplier. mdpi is 1.0, hdpi is 1.5, xhdpi is 2.0. Therefore 100dp in hdpi is actually 150px. An app with an

how to save ViewPager Current image to sd card on button click

北城余情 提交于 2019-12-13 07:14:33
问题 i am working on a image swipe app in which i am swiping images on ViewPager and i want to save current showing image to sd card on button click. my code: SwipeActivity.java package com.td.gridview; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.View;

Why are all the template images for icon in the Android developer site have resolution 72 pixels per inch under Ai and Photoshop?

雨燕双飞 提交于 2019-12-13 05:10:49
问题 The Android developer guide for icon launchers link gives the listed pixel and dpi specification for the different densities required. I downloaded the same templates for these images and in Photoshop the number of pixels for the ldpi, mdpi etc match up templates pack link. But the resolution when I check in Image -> Image Size -> gives me 72pixels/inch. I would expect that number of pixels per inch to match the dpi. How do I check the dpi or recongifure it to match the specifications of the

Picture from gallery to an imageview

怎甘沉沦 提交于 2019-12-13 04:35:30
问题 i'm trying to select an image from gallery to an ImageView but it doesen't work. Here's the code: public class Profilo extends MainActivity { private ImageView img; private Bitmap bmp; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.profilo); img = (ImageView)findViewById(R.id.profile_image); img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Intent.ACTION_GET

Scale images inside textview using ImageGetter

半腔热情 提交于 2019-12-13 04:23:19
问题 I'm trying to scale the images showed in the textview but i just can't. I'm using this code but no matter what, it shows the image cropped inside the container or doesn't show at all. int width, height; DisplayMetrics metrics = new DisplayMetrics(); metrics = Resources.getSystem().getDisplayMetrics(); int originalWidthScaled = (int) (result.getIntrinsicWidth() * metrics.density); int originalHeightScaled = (int) (result.getIntrinsicHeight() * metrics.density); if (originalWidthScaled >

Best way to download images from XML content

只谈情不闲聊 提交于 2019-12-13 04:14:07
问题 I am designing an Android application which will be displaying some news that will be retrieved from a remote URL in xml format, say http://adomain/latest.xml The XML file has the following format: <articles> <article> <id>6</id> <title>A sample title</title> <image>http://adomain/images/anImage.jpg</image> <lastupdate>1326938231</lastupdate> <content><![CDATA[Sample content]]></content> </article> ... </articles> I have created an Updater Service which listens to Connectivity Changes and

encode and decode base64 excpetion storing to sql server 2008 r2

我是研究僧i 提交于 2019-12-13 03:24:43
问题 I have an android client, I want to send image from my android to my server, i convert the image to byte array, then they byte array to base64, i send the base64 string to server, i decode it in the server then stored it in my sql server 2008 r2. my problem I can't store the string to my database then retrieve it correctly, I didn't get any exception and I get result but it seems it is the wrong result. i conclude that by doing this. 1- i send the base64 from android to server and saved the