安卓短信api,Android实现发短信和彩信功能(128个)

daniel 2024-02-18

Android实现发短信和彩信功能1

1、Android实现发短信和彩信功能

2、public void onClick(View arg0) {

3、<EditText

5、//创建意图对象

6、android:layout_marginTop=23dp

7、首先 activity_main.xml 布局:

8、android:layout_height=wrap_content

9、String phone_sms = edit_sms.getText().toString();

10、//获取电话号

11、/**

12、android:paddingTop=@dimen/activity_vertical_margin

13、<Button

14、android:text=@string/But_sms />

15、//获取发送的.短信

Android实现发短信和彩信功能2

1、}

2、// 意图对象

3、public class SmsActivity extends Activity {

4、intent.putExtra(subject, subject:I love you);

5、// 发送信息的操作

6、PendingIntent pendingIntent = PendingIntent.getBroadcast(

7、android:layout_width=wrap_content

9、android:id=@+id/sms_lable

10、android:layout_width=wrap_content

11、android:layout_below=@+id/phone_lable

12、return true;

13、<TextView

14、android:id=@+id/edit_sms

15、String phone_num = edit_phone.getText().toString();

Android实现发短信和彩信功能3

1、android:layout_marginBottom=14dp

2、android:layout_height=match_parent

3、android:layout_alignParentTop=true

4、edit_sms = (EditText) findViewById(R.id.edit_sms);

5、// 声明控件对象

6、}

7、butten_sms.setOnClickListener(new View.OnClickListener() {

8、*/

9、android:layout_height=wrap_content

10、android:layout_alignParentBottom=true

11、Toast.makeText(SmsActivity.this, 短信发送成功,Toast.LENGTH_LONG).show();

12、android:layout_below=@+id/edit_phone

13、.divideMessage(phone_sms);

14、intent.putExtra(address, phone_num);

15、smsmanager.sendTextMessage(phone_Num, null, c,

Android实现发短信和彩信功能4

1、//判断 信息长度 大于 70则分两条发送。。默认是70

2、intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(file:///sdcard/a.jpg));

3、android:layout_centerHorizontal=true

4、SmsManager smsmanager = SmsManager.getDefault();

5、/*// 获取短信管理器对象

6、public void send(){

7、intent.setType(image/jpeg);

8、接下来就是SmsActivity 中 主要代码 的实现 其功能 :

9、}

10、String phone_Num = edit_phone.getText().toString();

11、android:layout_marginTop=22dp

12、startActivity(intent);

13、protected void onCreate(Bundle savedInstanceState) {

15、<RelativeLayout xmlns:android=/apk/res/android

Android实现发短信和彩信功能5

1、android:id=@+id/phone_lable

2、@Override

3、//获取输入框组件

4、for (String c : contents) {

5、//吐司的效果

6、android:layout_height=wrap_content

7、xmlns:tools=/tools

8、android:paddingBottom=@dimen/activity_vertical_margin

9、android:paddingLeft=@dimen/activity_horizontal_margin

10、SmsActivity.this, 0, new Intent(), 0);*/

11、android:ems=10

12、android:layout_alignLeft=@+id/edit_phone

13、<TextView

14、//获取按钮组件

15、edit_phone = (EditText) findViewById(R.id.edit_phone);

Android实现发短信和彩信功能6

1、//设置显示视图

2、butten_sms=(Button) findViewById(R.id.But_sms);

3、android:inputType=textMultiLine />

4、android:paddingRight=@dimen/activity_horizontal_margin

5、// Inflate the menu; this adds items to the action bar if it is present.

6、android:id=@+id/edit_phone

7、private EditText edit_sms;

8、

9、@Override

10、android:text=@string/sms_lable />

11、super.onCreate(savedInstanceState);

12、android:layout_height=wrap_content

13、* 发彩信

14、android:layout_alignLeft=@+id/sms_lable

15、private EditText edit_phone;

Android实现发短信和彩信功能7

1、android:ems=10

2、getMenuInflater().inflate(R.menu.sms, menu);

3、//获取信息管理器对象

4、//获取号码

5、android:layout_above=@+id/But_sms

6、android:text=@string/phon_lable />

7、intent.putExtra(sms_body, content ::XXXX);

8、android:inputType=phone >

10、<EditText

11、android:layout_width=match_parent

12、//发短信 功能

13、pendingIntent, null);

14、smsmanager.sendTextMessage(phone_Num, null, phone_sms, pendingIntent, null);*/

15、android:layout_width=match_parent

Android实现发短信和彩信功能8

1、tools:context=.SmsActivity >

2、setContentView(yout.activity_sms);

3、然后在AndroidManifest.xml 中添加 发送短信的权限:

4、private Button butten_sms;

5、//意图对象

6、}

7、android:layout_height=wrap_content

8、Intent intent = new Intent(Intent.ACTION_SEND);

9、//注册按钮事件

10、ArrayListcontents = smsmanager

11、intent.putExtra(exit_on_sent, true);

12、});

13、}

14、public boolean onCreateOptionsMenu(Menu menu) {

15、android:layout_alignLeft=@+id/edit_sms

Android实现发短信和彩信功能9

1、PendingIntent pendingIntent = PendingIntent.getBroadcast(SmsActivity.this, 0, new Intent(), 0);

2、android:layout_width=wrap_content

3、@Override

4、/*//发送信息操作

5、android:id=@+id/But_sms

6、android:layout_width=match_parent

7、}

8、SmsManager smsManager = SmsManager.getDefault();

下一篇:给儿童春节祝福语(43句)
上一篇:暖心母亲节祝福语(经典25句)
相关文章