Open/close database ASAP
This commit is contained in:
parent
1119047891
commit
33ece37bba
@ -218,7 +218,7 @@ public class MultiSmsSender extends Activity {
|
||||
}
|
||||
public void sendMessage(Handler handler) {
|
||||
DeliveryDbAdapter mDbHelper = new DeliveryDbAdapter(this);
|
||||
mDbHelper.open();
|
||||
|
||||
SmsManager manager = SmsManager.getDefault();
|
||||
String message = mEditor.getText().toString();
|
||||
HashMap<String, Long> deliveryIdMap = new HashMap<String, Long>();
|
||||
@ -241,9 +241,11 @@ public class MultiSmsSender extends Activity {
|
||||
|
||||
|
||||
if (haveDeliveryReports) {
|
||||
mDbHelper.open();
|
||||
deliveryId = mDbHelper.createDelivery(message.substring(0, Math.min(30, message
|
||||
.length())).replace('\n', ' '), DateFormat.getDateInstance()
|
||||
.format(new Date()));
|
||||
mDbHelper.close();
|
||||
|
||||
}
|
||||
|
||||
@ -256,14 +258,16 @@ public class MultiSmsSender extends Activity {
|
||||
&& !phoneNumberConform.contains(newN)) {
|
||||
phoneNumberConform.add(newN);
|
||||
if(haveDeliveryReports) {
|
||||
mDbHelper.open();
|
||||
long entryId = mDbHelper.createEntry(mDbHelper.nameFromNumber(newN), newN, deliveryId);
|
||||
deliveryIdMap.put(newN,entryId);
|
||||
mDbHelper.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
mDbHelper.close();
|
||||
|
||||
|
||||
|
||||
numbers = new String[size];
|
||||
|
Loading…
Reference in New Issue
Block a user