imageview

How to set image as wallpaper from the ImageView?

删除回忆录丶 提交于 2019-12-05 05:56:22
问题 I have an activity in which there are two Buttons and an ImageView. One button is to take image from the Camera application of the phone and set it to the ImageView, and other Button is to set that image as the Home screen wallpaper so i want the code how to set this image from the ImageView to the wallpaper??????? 回答1: Step 1: Get the image attached to the ImageView. Setp 2: Set that image as Wallpaper. Step 3: Add permission in the AndroidManifest.xml to set wallpaper! For step 1 check This

ImageView won't show image when set by setImageBitmap()

陌路散爱 提交于 2019-12-05 05:49:11
I am having problems getting an existing image on the sdcard to display. ImageView _photoView = (ImageView)findViewById(R.id.img_photo); File photoFile = new File(Environment.getExternalStorageDirectory(), Session.PHOTO_FILE_NAME); rawFileInputStream = new FileInputStream(photoFile); Bitmap origPhoto = BitmapFactory.decodeStream(rawFileInputStream, null, new BitmapFactory.Options()); _photoView.setImageBitmap(origPhoto); Log.d(TAG, origPhoto.getWidth() + " - " + origPhoto.getHeight()); The photo does exist and the dimensions show up as displayed, but nothing appears within the ImageView tag

Why is wrap_content bigger than real pixel size?

孤街醉人 提交于 2019-12-05 04:55:58
问题 I am trying to understand something. A weird thing that I see is that when I put wrap_content in the width and hight, the image is bigger than the the real px (pixel) size of the image which is inserted. Why is that so? My code with wrap_content : <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="false" android:src="@drawable/header" /> and thats my code with exact pixel size of the image: <ImageView

Why imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); and <application android:hardwareAccelerated=“false” have different effect?

心不动则不痛 提交于 2019-12-05 04:34:35
I wonder why if I set <application android:hardwareAccelerated="false" using svg-android i see no image (due to hw acceleration problem?), but if I set imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); I can get it to work. Does View.LAYER_TYPE_SOFTWARE disables the hw acceleration or not? Wei WANG The direct answer to your question (Does View.LAYER_TYPE_SOFTWARE disables the hw acceleration or not?) is YES. It actually disable hw acceleration, but only at a view level, i.e. hw accl is disabled in imageView in your case, while setting android:hardwareAccelerated="false" will disable hw

How to return a Bitmap from an Async Task in Android app

…衆ロ難τιáo~ 提交于 2019-12-05 03:59:10
问题 Ok, so this code is right off the Android Developer site which sets an ImageView to a Bitmap : class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> { private final WeakReference<ImageView> imageViewReference; private int data = 0; public BitmapWorkerTask(ImageView imageView) { // Use a WeakReference to ensure the ImageView can be garbage collected imageViewReference = new WeakReference<ImageView>(imageView); } // Decode image in background. @Override protected Bitmap doInBackground

file path return null always in lollipop android

岁酱吖の 提交于 2019-12-05 03:38:56
this is my code when i'm getting image from internal storage (gallery). In lollipop file path return always null. if (requestCode == PICK_IMAGE) { if(resultCode == RESULT_OK){ //image successfully picked // launching upload activity Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null); cursor.moveToFirst(); columnindex = cursor.getColumnIndex(MediaStore.Images.Media.DATA); file_path = cursor.getString(columnindex); Log.d(getClass().getName(), "file_path"+file

Android Lollipop issue - Cannot load image from camera to ImageView

谁说我不能喝 提交于 2019-12-05 02:45:08
问题 On any version before android lollipop, the below code works fine. For some reason, from a certain version of android (around 5.0), whenever an image is captured from camera, the screen rotates 90 degrees to the right and back (Not only auto-rotate on my device is off, my activity is defined as portrait, it's not supposed to be rotating at all!). Once the screen rotates back, the ImageView presents the previous (original) image. Any suggestions? The camera intent: if (result.equals("CAMERA"))

How to get resource ID from Image Path?

[亡魂溺海] 提交于 2019-12-05 02:11:26
问题 I have an imagepath in android .This image exits on the sdcard of the device. How can i find resourceID of it ? I need to send it to decodeResource function. I am trying to detect faces on the image user selects from the gallery. The code that I have written is Intent intent = new Intent(this, DetectFaces.class); intent.putExtra(PICTURE_PATH,picturePath);//the path of the image startActivity(intent); In detectFaces class public void onCreate(Bundle savedInstanceState) { super.onCreate

Why the ImageView class is not found?

那年仲夏 提交于 2019-12-05 02:05:31
问题 i'm having troubles with creating the first android app (Silent Toggle Mode from the pdf "Android.Application.Development.for.For.Dummies" ) with inserting an Imageview in the main.xml file, when I go to the graphical layout, the image isn't showing itself and this error appears:"The following classes could not be found: - ImageView (Change to android.widget.ImageView, Fix Build Path, Edit XML)" this is my xml code <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns

bottom margin or padding doesn't work in relative layout in xml on android

梦想与她 提交于 2019-12-05 01:10:20
I have a RelativeLayout for a row that goes inside a ListView . The row looks like, <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="fill_parent"> <ImageView android:id="@+id/placeDetailIcon_Img" android:layout_height="50dp" android:layout_width="50dp" android:layout_alignParentLeft="true" android:paddingBottom="20dp" android:paddingTop="20dp" android:paddingLeft="20dp" android:paddingRight="20dp"/> </RelativeLayout> I also tried it with margin: <ImageView android:layout