Custom Listview in android application with images and texts

I have created database in external storage and i have stored image path and audio paths for each step in tables. Now from a new android application i want to access the table and extract in custom listview with image and text. Image are stored in a form of string in table. How do i get the image and view in custom listview?

-------------Problems Reply------------

static DisplayImageOptions op;
static ImageLoader loader = ImageLoader.getInstance();

In your onCreate

op = new DisplayImageOptions.Builder()
.displayer(new RoundedBitmapDisplayer(20)).cacheOnDisc(true)
.considerExifParams(true).build();

ListView list = (ListView) findViewById(R.id.customwhateverlist);
String query = "SELECT * FROM YOURTABLE with whatever you want ";

Cursor cursor = sqLiteDatabase.rawQuery(query, null);

((ListView) list).setAdapter(new MyCallitwhatyouwillAdapter(context,cursor, 0));

THEN...

private static final class MyCallItWhatYouWillAdapter extends CursorAdapter {

MyCallitwhatyouwillAdapter(Context context, Cursor cursor, int flags) {
super(context, cursor, flags);

mInflater = LayoutInflater.from(context);
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View v = mInflater.inflate(R.layout.SOMECOOLLAYOUT, parent, false);
return v;
}

@Override
public void bindView(View view, Context context, Cursor cursor) {
ImageView iv = (ImageView) view.findViewById(R.id.YOURIMAGETHINGEE);
//FOR IMAGELOADER YOU MUST HAVE "_id" INTEGER PRIMARY KEY" in database!!!
TextView blah = (TextView) view.findViewById(R.id._id);
blah.setText(cursor.getString(cursor.getColumnIndex("SomethingNiceColumn")));
loader.init(ImageLoaderConfiguration.createDefault(context));
loader.displayImage(cursor.getString(cursor.getColumnIndex("SavedPathToImage")), iv, op);
}

LayoutInflater mInflater;
}

and you will need to add imageloader as a library. You can get it here. https://github.com/nostra13/Android-Universal-Image-Loader

Category:android Views:3 Time:2018-03-08

Related post

  • Android ImageButton with Image and Text 2010-07-12

    I want to have a button that has an image on top and some text on bottom. Both the image and text are decided during runtime, so I want to be able to combine ImageButton's setImageBitmap and Button's setText for each button. Any ideas? Thanks Chris -

  • Button template with image and text in wpf 2010-04-28

    I want to create buttons with images and text inside. For example, i would use different images and text for buttons like 'Browse folders' and 'Import'. One of the options would be to use a template. I had a look at simliar question http://stackoverf

  • Android Scroll view Image and text 2013-12-03

    I am solving a problem with image and text in one scroll view. The main problem is, that I get different image height from server side . But the place with image should be all the time same. Now the height of image place is dynamic. The text should b

  • How to open Jquery UI dialog with image and text 2014-10-11

    I am novice in JQuery UI. I am trying code for opening jquery dialog with image and text from existing code in one of div tags. My code is <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script src="https://code.jquer

  • how do i create a custom cursor adapter for a listview for use with images and text? 2011-03-14

    Hi want to create a custom cursor adapter so I can display an image with 2 lines of text. I have had some trouble understanding the custom cursor adapters but I do not understand how to add an imageview to be filled from the path in my database. ----

  • Android: how to create a button with image and text that are both centred 2012-04-01

    I got stuck in an odd issue with Android - I want to have a button that looks like this: |-----------------------------------------------------------------------| | [icon] <5px> [text text text] | |----------------------------------------------

  • (android-layout) GridView with Image and Text adds extraspace around Image 2011-06-02

    I want a Gridview with Images and corresponding Text over them. It nearly does work, but there is some extraspace around my images. I first thought the space would be below textview und the imageview, but when removing the text, same space has been t

  • How to make a gallery with Image and text for android 2011-11-29

    I wanna make a Gallery, with a picture in the background and a textfield with invisible background... So I can see the text and the Image behind. I already made the Gallery but i cant figure out how to put text in the foreground. --------------Soluti

  • DIV with Image and Text 2009-03-31

    I want to create a DIV with a header of 6px height and inside the div body, I want to align an Image and Text next to each other. The height of the DIV body should be fixed. --------------Solutions------------- Here's a very simple example of how to

  • Winforms DataGridViewColumn with Image and Text 2009-10-14

    I am asking this question here as I could not find any conclusive results thru Google. HOw would it be possible to include an image and text in the same column in a Winforms datagridview? I have the following code handling the CellPainting event, but

  • Where can I find a super drop down menu with images and text details? 2011-07-11

    I'm curious how to build a similar menu with all the images and text details as in http://www.resellerclub.com/ Any ideas on the technologies used ? Are there any commercial solutions like this ? Thank you, --------------Solutions------------- They a

  • Dynamically generate HTML with images and text 2011-10-06

    I'm trying to dynamically insert images and texts using javascript, html and css. To be more specific, what I'm trying to achieve is to be able to insert x number of images and text. The image will be on the left and the text will be on the right of

  • android button with background and text,text not seems completely 2012-01-01

    My button has a background image and text,but some of the text does not appear. If i delete android:background=.... line, text seems good. How can i correct this ? Thanks much <Button android:id="@+id/button_game_bottom" android:layout_width="wrap

  • Jquery hover issue with image and text 2012-04-24

    Having issues trying to get this jquery code to work. The idea is that the opacity should change when the image is highlighted. Right now it is using the smallartcov class tag to change the opacity. The issue is that there is some text on top of it.

  • Android: any tutorial to write a ListView with image and text? 2011-10-10

    I want to write a ListView, with the list item be comprised by one image on the left, and text on the right. I am wondering is there any easy way to do this or tutorial?

  • ListView with images and text 2010-04-05

    This question already has an answer here: Lazy load of images in ListView 32 answers What's the way to create a listview with images on the left side and text right after it? (Note: the images were previously downloaded from the Net) Thanks in advanc

  • How to display context menu along with images and text views in Android? 2011-06-29

    I need to display the context menu along with images, text view and radio button. I have searched for answers but couldn't find a good one. I need help regarding this problem. --------------Solutions------------- Create your own custom menu. create a

  • Simple Custom ListView for Android Application? 2014-01-30

    I am a history teacher with minimal coding experience attempting to create a "presidential fact" application for my class. I've watched/read through multiple tutorials, but I cannot seem to successfully create a simple custom listview in which I can

  • How to add a button with image and text dynamically in Android GridView? 2011-07-13

    I want to add ImageButtons with text dynamically to a GridView (Something like below) and also set a listener such that a user enter a different page, when he clicks on an icon. The buttons will need to fill up horizontally first so I think I will ne

  • Winform, custom title bar with Image and text but no control buttons? 2011-08-16

    In winform application, how do i add image and title text in 'Title bar' and remove all control buttions (min, max & close). I could able to show image and title text but could not remove all buttons including 'Close' button. Is ther any workarou

  • How do I make an NSPopupButton that has a menu with images AND text? 2010-01-23

    I have a list of applications and I'd like to make an NSPopupButton that shows a menu of application names with their icon to the left of each item. I've been able to bind the NSPopupButton to my array of items, but there isn't a binding entry for an

  • Gallery with image and text 2011-12-18

    I'm trying to build a gallery with text below the image but although I've followed every response founded in here I've yet to accomplish my objective. public View getView(int position, View convertView, ViewGroup parent) { LinearLayout ll = new Linea

  • TableLayout with images and text 2010-06-18

    I would like to show an image in the left cell and text in the right cell of a tablerow. My problem is that the text-view is floating outside the visible screen, so I can't see the whole text. The text should break at the visible right end of screen.

  • List View with images and text 2011-03-22

    I'm trying to do a List that shows an image and a simple text describing the image. In my search on internet I found many ways to do this. Some people using ArrayAdapter, others using SimpleCursorAdapter. One thing I notice, many people are creating

  • GTK List with images and Text and other widgets 2009-10-21

    I am building a simple chat application under GTK+ and C, In that i need to display List of contacts like follows. 1. Window Containing contact list with contacts Presence and status Icons and name. +-----------------------------------------+ | [Pres

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.254 (s). 11 q(s)