开发学院手机开发Android 开发 Android模拟器互发短信 阅读

Android模拟器互发短信

 2010-09-06 08:15:00 来源:WEB开发网   
核心提示:}Log.e("message", sb.toString());/*** call an intent to start the activity DisplayMessage with variable* message data.*/Intent i = new Intent(context,

}

Log.e("message", sb.toString());

/**

* call an intent to start the activity DisplayMessage with variable

* message data.

*/

Intent i = new Intent(context, DisplayMessage.class);

i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

i.putExtra("message", sb.toString());

context.startActivity(i);

}

}

显示短信的Activity:

Java代码

package cc.androidos.sms;

import android.app.Activity;

import android.app.PendingIntent;

import android.content.Intent;

import android.database.Cursor;

import android.net.Uri;

import android.os.Bundle;

import android.telephony.gsm.SmsManager;

import android.util.Log;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

import android.widget.EditText;

import android.widget.ProgressBar;

public class DisplayMessage extends Activity {

private EditText messageText;

private EditText messageReplyText;

private Intent intent;

private String telNum;

private String message;

private Button replyBtn;

private ProgressBar bar;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.receiver);

messageText = (EditText) findViewById(R.id.message_get);

messageReplyText = (EditText) findViewById(R.id.message_reply);

replyBtn = (Button) findViewById(R.id.reply_button);

bar = (ProgressBar) findViewById(R.id.bar);

bar.setVisibility(ProgressBar.INVISIBLE);

intent = getIntent();

String data = intent.getStringExtra("message");

String[] str = data.split(":");

上一页  1 2 3 4 5 6 7 8  下一页

Tags:Android 模拟器 短信

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接