作者:wen260693700 | 来源:互联网 | 2023-07-24 21:57
Iamdesigninganappinthatiamstoringtheincomingmessagesinmyowncreateddatabaseandfrom
I am designing an app in that i am storing the incoming messages in my own created database and from this database i am displaying these messages in my application. for this i am using this code, To insert the data,
我正在设计一个应用程序,我将传入的消息存储在我自己创建的数据库中,从这个数据库我在我的应用程序中显示这些消息。为此我使用此代码,要插入数据,
mydb = openOrCreateDatabase("db",MODE_PRIVATE, null);
mydb.execSQL("CREATE TABLE IF NOT EXISTS sms_inbox (SMS_TEXT varchar , SENDER_NUMBER varchar );");
mydb.execSQL("INSERT INTO sms_inbox VALUES('" + stBody + "', '" + stPhoneNumber + "');");
To read the data,
要读取数据,
Cursor c = mydb.rawQuery("SELECT * from sms_inbox", null);
and then i am displaying these messages,
然后我显示这些消息,
So now my problem is this that I want to store these messages according to the phone numbers, example,
所以现在我的问题是,我想根据电话号码存储这些消息,例如,
phoneno.-12345 "ALL the messages of 12345 will be shown here" phone no.-23456 "ALL the messages of 23456 will be shown here"
phoneno.-12345“12345的所有信息将在这里显示”电话号码-23456“23456的所有信息将在这里显示”
1 个解决方案