Back to project page SMS-Generator.
The source code is released under:
Copyright (c) 2013 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without r...
If you think the Android project SMS-Generator listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.colindodd.smsgenerator.messaging; // w ww . ja v a2 s . c o m import net.colindodd.smsgenerator.data.Messages; import net.colindodd.smsgenerator.data.People; import android.content.ContentResolver; import android.content.ContentValues; import android.net.Uri; public class MessageHandler { public void generateRandomMessages(int numberToGenerate, ContentResolver contentResolver) { for(int i = 0; i < numberToGenerate; i++) { generateInboxMessage(People.getRandomPerson(), Messages.getRandomMessage(), contentResolver); generateOutboxMessage(People.getRandomPerson(), Messages.getRandomMessage(), contentResolver); } } private void generateInboxMessage(String person, String message, ContentResolver contentResolver) { generateMessage(person, message, contentResolver, Uri.parse("content://sms/inbox")); } private void generateOutboxMessage(String person, String message, ContentResolver contentResolver) { generateMessage(person, message, contentResolver, Uri.parse("content://sms/sent")); } private void generateMessage(String sender, String body, ContentResolver contentResolver, Uri uri) { ContentValues values = new ContentValues(); values.put("address", sender); values.put("body", body); contentResolver.insert(uri, values); } }