Problem invoking View Intent for Messaging App

by beachboy » Wed, 29 Apr 2009 15:04:20 GMT


Sponsored Links
 I am trying to view a message using the Messaging application on the
emulator. I created a message using Telnet and can see the message in
the Messaging App. I tried to invoke the view intent using the
following code. When this code runs the Messaging App starts but
displays the UI panel with the data as if I was a composing a message
rather than viewing the message.

  Uri uri = Uri.parse("sms:1234567890");
  Intent intent = new Intent(Intent.ACTION_VIEW,uri);
  intent.putExtra("sms_body", "testsmsmessage");
  intent.putExtra("compose_mode", false);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  Context.startActivity(intent);

What am i doing wrong?


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Retrieve HOME Contact Number from address book

hi guys,

currently i have a application which will retrieve all the contact
details and will display all the available Contact Names in a
SimpleCursorAdapter.

so once user select a particular name number will be displayed. which
works fine.

but now i want to display HOME and WORK numbers if available. how can
i achieve this?

below is my class

public class ConL extends ListActivity {
        private SimpleCursorAdapter myAdapter;
        TextView stat;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);
                stat = (TextView) findViewById(R.id.label);
                viewContacts();
        }

        public void viewContacts() {
                Cursor cursor = getContentResolver().query(People.CONTENT_URI, 
null,
                                null, null, People.NAME + " ASC");
                startManagingCursor(cursor);
                int x = cursor.getCount();
                if (cursor == null || x == 0) {
                        alert("Address Book", "Empty Address Book");
                }
                String[] columns = new String[] { People.NAME };
                int[] names = new int[] { R.id.label };
                myAdapter = new SimpleCursorAdapter(this, R.layout.test, cursor,
                                columns, names);
                setListAdapter(myAdapter);
        }

        public void alert(String header, String body) {
                new AlertDialog.Builder(this).setTitle(header).setMessage(body)
                                .setCancelable(true).setNeutralButton("Close",
                                                new 
DialogInterface.OnClickListener() {

                                                        @Override
                                                        public void 
onClick(DialogInterface dialog,
                                                                        int 
which) {
                                                                // TODO 
Auto-generated method stub
                                                        }
                                                }).show();
        }

        protected String[] isAssigned(String[] str) {
                String[] assign = null;
                for (int i = 0; i < str.length; i++) {
                        Cursor cur = managedQuery(People.CONTENT_URI, null, 
People.NAME
                                        + "='" + str[i] + "'", null, null);
                        if (cur != null) {
                                if (cur.moveToFirst()) {
                                        String title;
                                        // String phoneNumber;
                                        int nameColumn = 
cur.getColumnIndex(People.NUMBER);
                                        // int phoneColumn = 
cur.getColumnIndex(People.NUMBER);
                                        // String imagePath;
                                        do {
                                                // Get the field values

                                        } while (cur.moveToNext());
                                }
                        }
                }
                return assign;
        }

        @Override
        protected void onListItemClick(ListView l, View v, int position, long
id) {
                // TODO Auto-generated method stub
                super.onListItemClick(l, v, position, id);
                Intent intent = new Intent(Intent.ACTION_CALL);
                // alert("TEst", 
cur.getString(cur.getColumnIndex(People.NAME)));
                Cursor cursor = (Cursor) myAdapter.getItem(position);
                long phoneId = cursor.getLong(cursor
                                .getColumnIndex(People.PRIMARY_PHONE_ID));
                Uri uri = ContentUris.withAppendedId(Phones.CONTENT_URI, 
phoneId);
                Cursor cur = managedQuery(uri, null, null, null, null);
                String phoneNumber = null;
                String primaryKey = null;
                if (cur.moveToFirst()) {
                        Constants.selectedName = cur.getString(cur
                                        .getColumnIndex(People.NAME));
                        int phoneColumn = cur.getColumnIndex(People.NUMBER);
                        int type = cur.getColumnIndex(People._ID);
                        do {
                                // Get the field values
                                phoneNumber = cur.getString(phoneColumn);
                        } while (cur.moveToNext());
                }

                Intent i = new Intent(ConL.this, CustomScreen.class);
                Bundle b = new Bundle();
                Constants.mobile = phoneNumber;
                b.putString("Number", phoneNumber);
                i.putExtras(b);
                startActivity(i);
                finish();
        }
}

regards,
Randika

-- 

2. Putih-putih

si mbah ama cicit nya yawh?? ahahahahah :p




> Join:

3. Blapk Market down [again] ?

4. manage curosr in edit text...

5. Zoom 1 jari

6. How to get installed app size?

7. OOT Salam Kenal Semua