-1

i developed one sms related application by using the fallowing code.

http://mobiforge.com/developing/story/sms-messaging-android

sending and receiving sms is working fine.

but i want to maintain all receiving sms in a list.

if any one know this please help me.

Thanks in advance

kiran
  • 3,244
  • 7
  • 34
  • 57

4 Answers4

2

you can use

String day = android.text.format.DateFormat.format("dd.MM.yyyy",
                     new java.util.Date()).toString();

and check this question Date format conversion Android

Community
  • 1
  • 1
Jackson Chengalai
  • 3,907
  • 1
  • 24
  • 39
1

@kiran i am not getting exactly your question if you want to show sent SMS or what?if you want to show sent sms then i dont think there is any need to create your layout and show there as there is inbuilt api..please elaborate your question with your problems.

Sam
  • 76
  • 3
  • 9
1

Better you store all the values in the database. Create columns like receivedmsgs, sentmsgs, receivedtime, senttime,yourmobile,tomobile.

So when you send sms store all the values in the database, and using the yournummber you can get the sent and received messages so on....

Vamshi
  • 1,495
  • 1
  • 15
  • 31
0

Store the UNIX Epoch timestamp of the message. It fits in a long variable and very easy to convert between various date formats and even easier to run complex queries.

Eg.

SELECT * from smsTable WHERE timeStamp > %System.currentTimeMillis()% - 24L*60*60*1000

Gives you all entries for the previous 24 hours.

I'll also add, that's what the native application does.

st0le
  • 33,375
  • 8
  • 89
  • 89