Rotate ImageView source from layout xml file

You can use Available Since API Level 11 android:rotation=”90″ Final Code to Put, <ImageView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:rotation=”90″ android:contentDescription=”@string/image_divider” android:paddingBottom=”8dp” android:paddingTop=”4dp” android:scaleType=”fitXY” android:src=”https://stackoverflow.com/questions/11243314/@android:drawable/divider_horizontal_textfield” />

Get Bitmap from ImageView in Android L

If you just want the Bitmap from a ImageView the following code may work for you:- Bitmap bm=((BitmapDrawable)imageView.getDrawable()).getBitmap(); Try having the image in all drawable qualities folders (drawable-hdpi/drawable-ldpi etc.) Could be that the emulator or device your using has a different density and is trying to pull images from another folder. If you are using … Read more

Get Image from the Gallery and Show in ImageView

you can try this. paste this code in your button click event. Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType(“image/*”); startActivityForResult(photoPickerIntent, RESULT_LOAD_IMG); and below code is your on activity result @Override protected void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); if (resultCode == RESULT_OK) { try { final Uri imageUri = data.getData(); final InputStream … Read more

Android get image from gallery into ImageView

Simple pass Intent first: Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); And you will get picture path on your onActivityResult: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA … Read more

Adding text to ImageView in Android

To add a text to your ImageView you can do this: <RelativeLayout> // Only works inside a RelativeLayout <ImageView android:id=”@+id/myImageView” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”https://stackoverflow.com/questions/3404582/@drawable/myImageSouce” /> <TextView android:id=”@+id/myImageViewText” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignLeft=”@+id/myImageView” android:layout_alignTop=”@+id/myImageView” android:layout_alignRight=”@+id/myImageView” android:layout_alignBottom=”@+id/myImageView” android:layout_margin=”1dp” android:gravity=”center” android:text=”Hello” android:textColor=”#000000″ /> </RelativeLayout>

How do I resize an imageview image in javafx?

Yes, using an ImageView. Just call ImageView imageView = new ImageView(“…”); imageView.setFitHeight(100); imageView.setFitWidth(100); By default, it will not preserve the width:height ratio: you can make it do so with imageView.setPreserveRatio(true); Alternately you can resize the Image directly on loading: Image image = new Image(“my/res/flower.png”, 100, 100, false, false); Resizing the image on loading is useful … Read more

Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView

Eclipse tends to mess up your resources every now and then. This leads to some odd behavior such as strings and images being swapped all over your app, and more commonly classCastException(s), which happen when Eclipse switches your Views’ ids around. A few solutions to that problem: Clean your project. Modify an xml layout file … Read more