Hello everyone,
I've queried Android's CallLog.Calls and populated an ArrayList with my call model object however when I display these objects in a RecyclerView, certain phone-numbers appear multiple times, once for each call entry that was made from or to that number.
I'd like to group the calls from the same number together.
Is there a built-in way in Android to group these call entries so that I can display them as a single entry in my call log RecyclerView?
I tried to add "GROUP BY" to the query but contentResolver.query() does not seem to accept it in any of its parameters.
Thanks!
You can remove the duplications after you get the data using a HashSet, for example:
ArrayList<String> items = getItems();
HashSet<String> hashset = new HashSet<>();
hashset.addAll(items);
items = new ArrayList<String>(hashset);
Related
Hi,
I'm looking for a small app that will add a predefined string to all outgoing calls that i make.
Example: i enter 0476212121 and i want the phone to execute *123*0476212121. Is there any app that's able to do that ?
It's pretty like a string we use for prepaid calling card.
regards
Ced
thanks all for their help and wisdom
two teaks which i'm lookingsorry my search string didnt work for these questions)
how do you set filter in call history? it's set to all calls by default; can we change this default value (to miss calls or outgoing etc); also, why call history shows same number repeatedly (say you try to call 1 number 10 times, it shows you 10 times same number in history istead showing 1 time; it's pretty dumb as compare to other basic fone whr they only show 1 entry)
Other:
all contacts on phone; none on sim: how to take backup of only these contacts (pardon my ignorance; but i couldnt find way in outlook which is default for address book and contacts thru active sync); is there any 3rd party util especially designed to keep contacts saved in original format? (means 3 number/entry; 200 entry and that util keep exact copy and produce duplicate on restoring)?
thanks all to everyone
Hello,
I am using C# to send SMS from an application i'm writing.
i have tried either
1) Microsoft.WindowsMobile.PocketOutlook.SmsMessage
2) [DllImport("sms.dll")] int SmsSendMessage(...
but in both cases i need to specify a FULL phone number including country code (i.e. +972544...)
if i specify a regular number, the SMS won't reach.
the interesting thing is that when i use the built in SMS Phone's application and specify a regular number, the messages do reach.
So, have i missed something? Is there a standard way to make my messages be sent (have i forget a flag, special way of calling the API or what ?!)
Many thanks
Hi there,
I don't know a lot about programming, but maybe you could do something like the following example.
My country code = +316
Set all the country codes in a array (or something like it in C#)
When I type in the number 0612345678
Use some kind of script to split:
$countrycode = 06;
$phonenumber = 12345678;
Search in the array for '06'.
$newcountrycode = +316;
echo($newcountrycode,$phonenumber);
+31612345678
Click to expand...
Click to collapse
Maybe this will help?
issue resolved
Just to update - I found a solution to this problem
The API that I use is SmsOpen, SmsSendMessage, SmsClose (from sms.dll).
The SendSmsMessage API gets an address parameter which includes one of numerous values, the ones relevant for the solution are SMSAT_INTERNATIONAL (equals 1), And SMSAT_UNKNOWN (which is 0)
If the number starts with “+” use international, else use unknown and the phone will figue this out and add the relevant extension. Note however that the latter might not work when roaming.
enjoy
Hi
I want to write an app that goes through all my stored SMS, lets me pick one and then would display the SMSC address which was involved in sending said SMS to my phone.
Question: Is this SMSC address stored somewhere? And just to be totally clear: I am not asking for the SMSC address of my operator which would be used for sending SMS from my phone to other phones, okay?
I tried to find something in the deprecated SMS content provider. But either I did not look hard enough or it's simply not there.
Has anybody got some tip for me regarding this?
thanks a lot!
gsm-man
Try the following code:
ContentResolver cr = context.getContentResolver();
final Cursor c = cr.query(Uri.parse("content://sms/inbox"), new String[]{"_id", "address", "date", "read", "body", "service_center"}, null, null, null);
Good afternoon. There is a task to develop a client for android news site. For notification of new posts to be used gcm.
Estimated algorithm:
1. Run the application, the database is empty, make a request to the api get the last 20 records, id 1000 to 980, write to the database.
3. Listview is scrolled to the last record, make a request for records whose id is less than 980, we record from 979 to 959 write to the database.
3. Comes gcm message or clicked update, make a request to the api, get the records whose id> 1000, we record with id 1001 to 1021 write to the database.
The question arises - how to behave in a situation where we assume the device was offline for a week, during which added another 1000 records.
The device connects to the network, gets send-to-sync message, makes a request to the api to get records whose id> 1021, in response to the 1000 records to come.
Intuition suggests that load all 1000 records are not correct, you need to download and say the last 20, but then it turns out that the database will be news for today, last week they will not, and then go for the news before last week
And question number 2 - how to clean old records, to avoid infinite growth of the DB?
What about this: make another table that have only 20 records and when a news comes, it stores it on the first record and deletes last record. Of course records 2-19 iterate.
When you get news on device, get them from this table. If you want to get older news, get the last id from this table and get next 20 news from table that stores all of the records.
---------- Post added at 10:29 AM ---------- Previous post was at 10:20 AM ----------
Answering question 2:
The best solution for me is to make model class News . It makes everything easier with DB. If you have this, you can do something like this:
public void deleteAllNews(){
String selectQuery = "SELECT * FROM " + TABLE_NEWS;
SQLiteDatabase db = this.getWritableDatabase();
Cursor c = db.rawQuery(selectQuery, null);
// looping through all rows
if (c.moveToFirst()) {
do {
db.delete(TABLE_NEWS, KEY_ID + " = ?", new String[] { String.valueOf(c.getInt(c.getColumnIndex(KEY_ID)) });
} while (c.moveToNext());
}
db.close();
c.close();
}