As 4castle suggest, you should really have a custom class – which looking at the properties you are interested in, you might want to name “CallLogEntry” and then have properties for this class. Here is an example of such a custom class.
public class CallLogEntry {
String number;
String type;
String date;
String duration; //this should ideally be of type Long (milliseconds)
public CallLogEntry(){
//do stuff if necessary for no-params constructor
}
public CallLogEntry(String number, String type, String date, String duration){
this.number = number;
this.type = type;
this.date = date;
this.duration = duration;
}
//getters and setters go here..
getNumber(){ return this.number;}
setNumber(String number){ this.number = number;}
//...the rest of them...
}
Than it makes more sense to have an ArrayList of CallHistoryEntry items like this:
//...declare list of call-log-entries:
List<CallLogEntry> callLogEntryList = new ArrayList<CallLogEntry>();
//...add entries
CallLogEntry entry = new CallLogEntry(number, type, date, duration);
callLogEntryList.add(entry);
The advantage of doing it like this, especially in an Android app, is that later you may pass this list to some list-adapter for a list-view.
I hope this helps.
2
solved How to convert multiple string into arraylist?