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

Android模拟器互发短信

 2010-09-06 08:15:00 来源:WEB开发网   
核心提示:if (str.length == 2) {telNum = str[0];message = str[1];}messageText.append(data);messageText.append("");// messageText.append("");replyBtn.s

if (str.length == 2) {

telNum = str[0];

message = str[1];

}

messageText.append(data);

messageText.append(" ");

// messageText.append(" ");

replyBtn.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

bar.setVisibility(ProgressBar.VISIBLE);

String replyMessage = messageReplyText.getText().toString();

SmsManager smsMgr = SmsManager.getDefault();

Intent i = new Intent("cc.androidos.smsdemo.IGNORE_ME");

PendingIntent dummyEvent = PendingIntent.getBroadcast(

DisplayMessage.this, 0, i, 0);

try {

smsMgr.sendTextMessage(telNum, null, replyMessage,

dummyEvent, dummyEvent);

messageText.append(replyMessage);

messageText.append(" ");

messageReplyText.setText("");

} catch (Exception e) {

Log.e("SmsSending", "SendException", e);

}

bar.setVisibility(ProgressBar.INVISIBLE);

}

});

}

/**

* get the name by his tel number.

*

* @param telNum

* @return

*/

private String getNameByIdTelnum(String telNum) {

Cursor mCursor = this.getContentResolver().query(Uri.parse("telNum"),

null, null, null, null);

String result = mCursor.getColumnName(1);

Log.e("test name", result);

return "";

// mCursor.getColumnIndex("Sun");

}

}

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;

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

Tags:Android 模拟器 短信

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