Dynamically show images from resource/drawable - android

I have few images in res/drawable folder. I have a SQLite DB. I have a GridView where I display all the images. I select a image and fetch corresponding URI of the image selected.
Now when I select the image the URI is displayed in EditText. Then I submit that message along with image. In ListView I display the message along with all the messages from WebService.
I need to display the corresponding image instead of URI in EditText.
I need to display image from EditText into Listview where i display the entire list of messages from WebService.
I need to submit the message in EditText and fetch back the same message from WebService along with image.
How can I achieve that?
I have done till getting the corresponding URI of the selected image from local DB. Now i need to get the image instead of URI.
please guide me in solving this problem.
Thanks & Regards,
Raghav

Edit Text is for text input only.
You do not have the flexibility of showing an image.
How ever, if you have the data available with you you can try
editText.setText(Html.fromHtml(stirng));
However, if the image is remote then you will get a box.. and I don't have info how to load it from resources.

Related

How to add text content first time from first API and add Images from second API in same recyclerview^

I want to show list with images and text .But problem is, data is huge when i fetch image and text in one API , it takes too much time too load. So i want to show text first from first API and show in recyclerview,which i can do. But, how to add images after that in same recyclerview, which i was calling from second API.
Your Adapter should hold both text and image per entry.
Upon text received, you load and update the RecyclerView as you do, and since the image field is null, you hide or show a placeholder image.
Once the real image is ready, you update the datasource and notifyItemChange, so that the cell is re-binded and you can show the image.
However I would strongly suggest to keep the model hold meta data (ie. String text and URL image) and use Fresco or Picasso to handle the image loading.

Variable number of image buttons

basically what am doing is am querying some data from firebase and inside these data is a URL for an image of a specific item. Now since its a query i could get different result form the firebase where i can get 4 images or sometime maybe 1 image.
And i want to display the images in a grid layout ( similar to that of Instagram posts) where the user can click on an image and it shows the user some details about that item. This is the part where am stuck at.. i dont know how to do it since i have a variable number of images.
if there is a way, please help
you can use the Recyclerview and provide the model with those details. It will automatically create those many rows in list.
Here you can follow this to do this.

How to display every list item with in viewpager in android

First sorry for my bad English and this is simple question but i google it no solution found i found this is only place to getting solution ,In my JSON Object contains lats of images and images title and description ,I my first pages i want to display image title and image after click the image bundle the data and display all field their,when i trying to this in list view its working perfect ,but i need to display this in view page ,like below screen i need to display like this ,my json update every hours getting new images please any one guide me how to do this ,after swipe up i get next images from json
here below my screen

Android Custom AutoComplete textview image and text

I have a user list. Every user has name and image. I want to display these users in AutoCompleteTextView. Users' name and image must be displayed in autoCompleteTextView.So I am customizing AutoCompleteTextView to display images and text. I get help from wptrafficanalyzer site.
See: http://wptrafficanalyzer.in/blog/customizing-autocompletetextview-to-display-images-and-text-in-the-suggestion-list-using-simpleadapter-in-android/
But images are used in drawable folder in project. But I want to use from url to image. Should I use a custom adapter instead of simple adapter? How to do this case?
Thanks

How to display images on demand inside a listview?

I am building a android aplication which will be consuming a json file from the internet. This json file contains a list of news from a particular website. Each json object contains information such like title, summary, descripition and web links for the news thumbnail and the original image.
I will be displaying in a listview three information: the news thumbnail, the title and the summary. Here resides my problem. I dont want to load all thumbnails from the internet if they wont be displayed. What I am trying to say is that why download a thumbnail from the 30th news if the user wont scroll down the image. So, i will, initially only download the thumnails from those news that are being displayed in the screen and when the user scrolls down to see more news, as soon as the list item appers to the screen i want to download the image and then display.
Is there a way to achieve this? Is it possible to find out if the list item is on the screen? I have been searching all over the internet for a solution for this but i am running out of ideas.
Thanks
T
You essentially want to lazy load your images. This will only load images that are currently being shown and as you scroll through the list view it will go and fetch those currently shown images.

Categories

Resources