I'm trying to find a way to store the name of an icon in my database, then use that name to let a user select an icon from an ImageView. I've found various guides on ImageViews and Galleries, but none that show how to get/set the selected image by name. The list of available images won't change, but what's that best way to implement this?
check this tutorial, it can give you an Idea of how to do it:
http://www.firstdroid.com/2011/02/06/android-tutorial-gridview-with-icon-and-text/
Good luck.
Adrian.
Related
I have a problem, I want to show one image in ImageView, but I want to give user options to choose from list image (maybe put text somewhere in there).
and maybe save it on firebase database, so when user reopen/restart the app, that image user choose/select before will show somewhere in their profile/activity.
so far I've tried RadioButton, CheckBox, Spinner.
and non of them work, maybe I don't know implement it properly.
I'm hoping someone help me solve this, it's help a lot.
thanks.
I am trying to create a custom gallery with a single select option. I've used the code provided by google docs to create a GridView that contains the images contained in drawable.
Now I want to change it by making the GridView show all the images stored in the phone.
To get all images from the phone you need to query the android.provider.MediaStore
First make sure you have the AndroidPermission.READ_EXTERNAL_STORAGE, then get the thumbnails for the grid.
Here is a simple way to do this:
HERE
Hope this helps.
If this has already been asked, forgive me. But I'm wondering if there is a simple way to adjust the transparency for ListView selection. I know how to change the color, but is there any attribute that allows to adjust the transparency? Or would you have to upload some custom background?
If by transparent you mean see-through, and by ListView selection you mean a single item of the ListView, then its called alpha. The link should show you the info for the XML, but you can also set it using setAlpha(), which is accessible to any View.
I'm fairly new to Android programming and I've got this project I need to finish and I'm currently stuck.
I've got a standard listview in a Menu class with an array containing around 20 different elements. So what I want to do is load images in an imageview depending on which item in the listview I click, and since I'm a beginner the only idea I had was to make a new activity for each imageview which seems like a pretty bad way to do it since I'd need about 20-30 new activities..
To sum things up what I want is:
Code for making ONE activity that will display a different image depending on which item in the listview I click, probably pretty basic coding I want as simple solution as possible.
If possible I'm also looking for a solution that includes an SQLite database that stores the URL of an image and then display it in a single activity, also depending on which item I press in my current listview.
(I hope you understand my needs, and if you need I can also post my current code for the Menu class if it helps you help me) Or you can just show me a different way to make this work, I appreciate every answer! Thanks in advance!
NOTE
And please keep in mind, I'm a noob at Java and Android so keep it rather simple or at least explain what you do.
When you click on a list item, display the image in another view in the same layout, unless you want the image to take up the entire screen real estate. If you want it in the entire screen, go to a new Activity by sending the activity an Intent.
Activities are the "controller" of your application. They interact with the visible UI and the input from the user. You don't need a separate activity for each image, just an activity that's associated with a "place" in the UI (an ImageView) where you'll display the image.
I'd start by adding the images as resources under res/drawable before going on to databases.
You are going to have to do most of this yourself. There really isn't any substitute for taking the time to learn Java and Android. There are several tutorials and Android University classes under the Resources tab in the Developers Guide; I suggest you do all of them.
how can I access the button on the left in androids search dialog?
http://developer.android.com/images/search/search-ui.png
In the picture above I want to set an onClickListener onto the books icon.
Thanks in advance
Unfortunately, there's no way to do it. You could get to the layout and its elements if you had necessary ids. But the ids of the elements used by SearchDialog are not public, that's why you don't have access to them.