How to implement search view for list view?

I wish to develop a simple SMS application for Android. And its only function is to show a threaded view of conversation between user and sender, when sender's phone number is given as an input. Could someone point me in the right direction?

  • If possible could someone give me the code to implement it. I'm aware that a cursor (which contains all the sent and received messages from sender) can be used. But after getting the cursor containing the entire list, how do I display it in a threaded view? I'm very new to developing android applications, so I would be glad if someone could give the code for both Retrieving SMS (from Database) and creating threaded UI (ViewAdapters...etc). I've referred a few open source Android-SMS applications, but the code is really complex and on importing I get many errors.

  • Answer:

    I suggest picking a simpler, smaller challenge for your first app.  You're struggling because you have not only the challenge of learning Android, but also wrestling with a not-so-simple problem. There isn't really any shortcut to learning quite a bit more (with the possible exception of finding an open source library that you can drop in).  Anything involving contacts and databases on Android is by necessity a complex operation, which the code you've seen should hint at. Whatever you do, don't try to download the Android platform source code and puzzle it out - while it is indeed open source, it's a monumental amount of code and complexity to handle a wide variety of devices and situations.

Tim Mackenzie at Quora Visit the source

Was this solution helpful to you?

Other answers

You are not getting much better than looking at existing open-source SMS applications. You will have to do the hard work to figure it out yourself.

Corneil du Plessis

For starters, you will need to learn the following: How to use a broadcast receiver to Listen to incoming messages. http://stackoverflow.com/questions/4117701/android-sms-broadcast-receiver How to send an SMS using the android api - http://www.mkyong.com/android/how-to-send-sms-message-in-android/ Sqlite Database Read/Write operations - http://www.vogella.com/tutorials/AndroidSQLite/article.html The UI component of it to create a list type view to show the messages. http://stackoverflow.com/questions/11202206/create-a-chatview-layout-in-android No one is going to give you ready-made code for free.  I have put up a few links from where you can start off. If you know the concepts of android , it should be easy to follow and implement. Don't blindly copy-paste code from places - first understand it and then implement it.

Suhas Grama

Basically you need to read the SMS database that is contained on the phone.  Its a little tricky, because you have to aggreate the SMS from the inbox/outbox/ and MMS.  MMS is stored in a separate table.  There is more detail to this, but I will post some code from an app I wrote that does this to help out.

Steve Loper

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.