user1992592
user1992592

Reputation: 21

How to add messages to the inbox of AVD

public class SearchableActivity extends ListActivity {
    String options[]={"got nothing here "};
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        /*
        Uri uriSMSURI = Uri.parse("content://sms/inbox");
        Cursor cur = getContentResolver().query(uriSMSURI,new String[] { "_id", "thread_id", "address", "person","date", "body" }, null, null,null);
        int i=0;
        if(cur.getCount()>0) {
            while(cur.moveToNext()) {
                String smsBody = cur.getString(5);
                options[i++]=smsBody;
            }
        } else {
            options[0]="got nothing here ";
        }
        cur.close();
        */
        setListAdapter(new ArrayAdapter<String(this,android.R.layout.simple_list_item_1, options));
    }

The code within comment /**/ makes the app crash.

Is AVD inbox empty by default?

If yes, then how can I feed some messages to it?

Upvotes: 1

Views: 145

Answers (2)

Gaurav
Gaurav

Reputation: 304

Connect via Telnet to the running emulator (5554 is the emulator number):

telnet localhost 5554 

Type this:

sms send phoneNumber textmessage

Upvotes: 1

Charan Pai
Charan Pai

Reputation: 2318

You can send messages to AVD using DDMS in Eclipse DDMS Prespective :)

Go to menu Window -> open Prespectiv - > DDMS prespective -> emulator tab -> send SMS.

Upvotes: 2

Related Questions