How to show /save receive message in text box

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

How to show /save receive message in text box

Postby basit bilal » Wed Jul 28, 2010 11:05 am

can any one help me how to show/store receive msg in text box.

I have wright the code but receive msg show on the top of the emulator screen .

package net.learn2develop.SMSMessaging;




import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;

import android.provider.MediaStore;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;



public class SMSReceiver extends BroadcastReceiver {

String txtEncryptedMessage ;
public SMSReceiver(String passedView)
{
txtEncryptedMessage=passedView;
//String incoming_SMS =
//"android.provider.Telephony.Sms.Intents.SMS_RECEIVED_ACTION";

}
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();

Object messages[] = (Object[]) bundle.get("pdus");
SmsMessage smsMessage[] = new SmsMessage[messages.length];
for (int n = 0; n< messages.length; n++)
{
smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
}
/* Logger Debug-Output */
Log.i(txtEncryptedMessage, "[SMSApp] onReceiveIntent: " + txtEncryptedMessage);
// show first message
Toast toast = Toast.makeText(context,"Received SMS: " + smsMessage[0].getMessageBody(), Toast.LENGTH_LONG);
toast.show();
//txtEncryptedMessage=smsMessage[0].getMessageBody().toString();

//@SuppressWarnings("unused")
///String message=smsMessage.toString();
// txtEncryptedMessage=toast.toString();
/// txtEncryptedMessage=(View) findViewById(R.id.EncryptedMessage);
}
}

Plz help me to solve my problem

abbilal@hotmail.com
basit bilal
Freshman
Freshman
 
Posts: 3
Joined: Wed Jul 28, 2010 8:03 am

Top

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests