Viewing SMS Message Details with Messaging/SMS Intent

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


Sponsored Links
 I have a message that my app has retrieved from the SMS content
provider and I would like to invoke the Messaging/SMS App to View the
message. When I use the code below it appears that the UI panel that
is displayed is combination of the UI panel of view and compose
message from the Messaging/SMS App. The body of the message is stored
in the compose edit box next to the send button. When you click on a
message from the Messaging/SMS app the message and its details are
displayed above the compose edit box indicating that we are not
composing a new message. Can anyone tell what I am doing wrong in the
code below?

  Uri uri = Uri.parse("sms: ");
           Intent intent = new Intent(Intent.ACTION_VIEW,uri);
           intent.putExtra("compose_mode", false);
           intent.putExtra("message_id", id);
           intent.putExtra("address", "1234567890");
           intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
           mContext.startActivity(intent);


Thanks,

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



Other Threads

1. Android MediaPlayer sometimes stops playing a sound file early

I am triggering a MediaPlayer to play a sound on a button click.
Sometimes, the player will play the whole sound, sometimes it will
not. It always cuts off on the end. I read a few threads on here/
stackoverflow where people were having the same problem, but none of
the suggestions worked. For example, someone said that adding a
mediaPlayer.onCompletionListener() would fix the issue, but it has
not.

There were a couple posts on here about similar issues, but no real
fixes.

I can reproduce this problem on the emulator, but not my htc
incredible or my girlfriend's moto droid 2, which are both running
android 2.2.

It seems to be an issue with the 'end' parameter in setDataSource(). I
can add ~3000 bytes to end and that fixes the problem in the emulator,
but then if I run the app in my phone it cases the audio to loop back
around to the start.

Here is the code:

public View getView(int position, View convertView, ViewGroup parent)
{



            LayoutInflater inflater = getLayoutInflater();
            View row = inflater.inflate(R.layout.vocab_row, parent,
false);

            ImageView playIcon = (ImageView) row
                        .findViewById(R.id.blueplay_icon);
        TextView vocabWord = (TextView) row
                .findViewById(R.id.vocab_text_word);
        TextView vocabMeaning = (TextView) row
                .findViewById(R.id.vocab_text_meaning);

        vocabWord.setText(data.get(position).getKey());
        vocabMeaning.setText(data.get(position).getDefinition());

        final String fileName = "audio/" +
data.get(position).getAudio();

        // set the click listener for the play button
        playIcon.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {

                final MediaPlayer player = new MediaPlayer();
                AssetManager manager = SingleLesson.this.getAssets();
                final AssetFileDescriptor descriptor;

                try {

                    descriptor = manager.openFd(fileName);
                    long start = descriptor.getStartOffset();
                    long end = descriptor.getLength();

                    //reset player
                    if (player != null) {
                        player.reset();
                    }

 
player.setDataSource(descriptor.getFileDescriptor(),
                            start, end);

                } catch (IOException e) {
                    Log.e("IO EXCEPTION: ", "while getting mp3
assets.");
                    e.printStackTrace();
                }

                // set volume
                player.setVolume(100, 100);

                try {
                    player.prepare();
                } catch (IllegalStateException e) {
                    Log.e("ERROR: ", "media player, illegal state");
                    e.printStackTrace();
                } catch (IOException e) {
                    Log.e("ERROR: ", "media player, IO exception");
                    e.printStackTrace();
                }

                player.setOnPreparedListener(new OnPreparedListener()
{

                    @Override
                    public void onPrepared(MediaPlayer inPlayer) {
                        player.start();
                    }
                });

                // called when the file is finished playing
                player.setOnCompletionListener(new
OnCompletionListener() {

                    @Override
                    public void onCompletion(MediaPlayer player) {
                        player.stop();
                        player.release();
                    }

                });
            }
        });

-- 

2. Do You Want To Create An Application Icon?

I am sorry if this is the wrong thing to do, I am a newbie. I am
writing my first app and I was wondering if there were any graphic
designers out there who would want to create an icon for my app.

My app will be / is called "Droid Notify" and it's a basic app that
will display a pop up notification on the screen for incoming text
messages, missed calls and perhaps calendar appointments. I am writing
this app as an open source app on code.google.

Let me know if anyone is interested. I was thinking of the Android
Robot (green) with a bullhorn, or something along those lines.

Thanks

-- 

3. How to get the "Complete Action Using" dialog to come up

4. Impact on existing app if I changed my "Developer Name"

5. How to detect Market / Non-Market(Unknown Sources) applications on android? How to programmings?

6. About limejs

7. Cannot run the Android in Eclipse