File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes ListView Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "ListView Problem" Watch "ListView Problem" New topic
Author

ListView Problem

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi,

I am making an application in which user can configure their mail accounts.
I am able to retrieve mails from mail server.But the problem is with view.I am using SimpleAdapter to display the content.It works fine when there is only text content.

What I want to do is when mail has an attachment, I want to display an icon instead of text.Now this creates problem because I have used Arraylist to pass the argument in SimpleAdapter.

Is there any one who has solution of this.

If question is not clear to anyone they can ask for more.

Please I am stuck up here since 3 days.

Thank you
James Elsey
Ranch Hand

Joined: Dec 21, 2007
Posts: 228

can you post up some of your code so we can see what you are doing?


Kind Regards, James. OCPJP 1.6 || My SCJP / OCJCP Study Notes
Interested in : SCJP, Google App Engine, Stripes, Android;|| My Bite-Size SCJP Study Blog
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
James Elsey wrote:can you post up some of your code so we can see what you are doing?


I have not started the code because I have no idea from where I should start
I know how to do mapping between data and fields (i.e from and to) in SimpleAdapter but what about images.

OK,you must have seen Email application given with android SDK preinstalled.When you view your inbox your mails are listed.I want to prepare same kind of view.

But for your reference I am giving image.


I want to prepare above kind of view.But with the SimpleAdapter
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
The SimpleAdapter javadocs talk of either a boolean, a string or an image, not of combinations thereof (which is probably what makes it "Simple"). You'll probably have to use an ArrayAdapter, or subclass it.
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi, first of all thank you for the reply.

I refer some example of ArrayAdapter but still can not make it out.
Can you share some demo code?
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
What do you have so far? What does your layout look like, particularly its XML definition?
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
This is how my xml looks like.


It is not similar to above given image.I have removed some content.I will add them later.The ImageView tag I have taken to display attachment icon.
Piyush Patel
Ranch Hand

Joined: Feb 24, 2009
Posts: 127

Have you looked at API demo supplied with Android SDK ? please go through API Demos and there are 6-7 examples of ListActivities.

There is one example in API Demo for list activity that will solve you problems, it shows how to create customized Adapter.

hope this helps.. write back to forum if problem remains..

Regards,
Piyush

 
wood burning stoves
 
subject: ListView Problem