In Android Studio How to make Validation for imageview? - java

How to make validation in android studio for image view.
E.g. I have button when i click on button it open a gallery and i select image it comes in image view but how to set that if someone not upload image it will show message till not upload image in image view
Thanks.

The uri or bitmap that you use to save the image, use it in sharedPreferences. So that when the default value is null user will get the message but when you add a new image it will overwrite the default value of sharedPreferences and hide the messgae.

Related

How to set VideoView in Bundle when retrieving

I have tried using this syntax but it depicts that "Cannot resolve method 'into(android.widget.VideoView)'" when retrieving video (https://i.stack.imgur.com/EScos.png)
I want to retrieve video in VideoView as well as its TextView from one layout to another layout after a user clicking on the data to view more details about the data at the other page.

how to set drawable background of edit text programmatically

Hello every one I am new in the android studio I have a picture in my drawable folder and I want it to save the picture as a background of the edit text programmatically for this I write a code bellow but its not working and it showing a red line error
here is my code.
edit_text.setBackground(R.drawable.background1);
any idea for this how I will write it
please don't suggest me another post as I am new here.
You should retrieve the background drawable using ContextCompat.getDrawable method:
edit_text.setBackground(ContextCompat.getDrawable(this, R.drawable.background1));

How to display an image in Dialog using Glide?

in my app there is an dialog with an image on it.
How can I display an image using glide?
Here is what I tried in my Fragment:
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.drawable.goldversiondialog)
.error(R.drawable.goldversiondialog);
Glide.with(getActivity()).load(myURL).apply(options).into(goldimageview);
It is not working, it only displays the error image.
I also don't know what to write as context, "this" is not working in fragments.
How can I solve this?

How to implement Database content in .xml and present it in a listview

I am trying to create an app that will have a listview in it when clicking each listview will open an .xml file containing data and images stored into database.
I just want to know how to implement them into .xml and present into listview.
Thankyou
Actually you have to create another activity which inflate your xml which contain ImageView and more.and then pass id as intent and access content from database using id.and set image in imageview accordingly. This link may help you
http://yournextleap.blogspot.in/2012/02/insert-image-to-database-and-display.html

How to know the status of the pages in a ViewPager

I'm implementing a image gallery with a ViewPager.
Each page load a image from Internet and put it in a ImageView.
The gallery also have a share button (external to the ViewPager).
I want to disable the button when the image is loading and re-enable it when the image is visible.
How can I know the status of the current page (if the image is beeing displayed or not) from the Activity containing the ViewPager?
Thanks
You can override setPrimaryItem function
public void setPrimaryItem(android.view.ViewGroup container,
int position, Object object) {
super.setPrimaryItem(container, position, object);
//check if image is loaded here
};

Categories

Resources