欢迎来到天天文库
浏览记录
ID:6007631
大小:26.50 KB
页数:2页
时间:2017-12-30
《android利用intent发送彩信》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Android利用Intent发送彩信Activity_main.xml2、argin"android:paddingLeft="@dimen/activity_horizontal_margin"android:paddingRight="@dimen/activity_horizontal_margin"android:paddingTop="@dimen/activity_vertical_margin"tools:context=".MainActivity">3、ut_height="wrap_content"android:text="发送彩信"/>MainActivity.javapackagecom.example.activity05;importandroid.net.Uri;importandroid.os.Bundle;importandroid.app.Activity;importandroid.content.Intent;importandroid.view.Menu;importandroid.view.View;importandroid.vi4、ew.View.OnClickListener;importandroid.widget.Button;publicclassMainActivityextendsActivity{privateButtonmybut=null;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);mybut=(Button)findViewById(R.5、id.mybut);mybut.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubUriuri=Uri.parse("file:///sdcard/right.png");Intentit=newIntent();it.setAction(Intent.ACTION_SEND);it.putExtra("address","11111111111");it.putExtra("sms_bo6、dy","北京魔乐科技软件学院");it.putExtra(Intent.EXTRA_STREAM,uri);it.setType("image/png");MainActivity.this.startActivity(it);}});}@OverridepublicbooleanonCreateOptionsMenu(Menumenu){//Inflatethemenu;thisaddsitemstotheactionbarifitispresent.getMenuInflater().inflate(R.menu.main,menu);r7、eturntrue;}}
2、argin"android:paddingLeft="@dimen/activity_horizontal_margin"android:paddingRight="@dimen/activity_horizontal_margin"android:paddingTop="@dimen/activity_vertical_margin"tools:context=".MainActivity">3、ut_height="wrap_content"android:text="发送彩信"/>MainActivity.javapackagecom.example.activity05;importandroid.net.Uri;importandroid.os.Bundle;importandroid.app.Activity;importandroid.content.Intent;importandroid.view.Menu;importandroid.view.View;importandroid.vi4、ew.View.OnClickListener;importandroid.widget.Button;publicclassMainActivityextendsActivity{privateButtonmybut=null;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);mybut=(Button)findViewById(R.5、id.mybut);mybut.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubUriuri=Uri.parse("file:///sdcard/right.png");Intentit=newIntent();it.setAction(Intent.ACTION_SEND);it.putExtra("address","11111111111");it.putExtra("sms_bo6、dy","北京魔乐科技软件学院");it.putExtra(Intent.EXTRA_STREAM,uri);it.setType("image/png");MainActivity.this.startActivity(it);}});}@OverridepublicbooleanonCreateOptionsMenu(Menumenu){//Inflatethemenu;thisaddsitemstotheactionbarifitispresent.getMenuInflater().inflate(R.menu.main,menu);r7、eturntrue;}}
3、ut_height="wrap_content"android:text="发送彩信"/>MainActivity.javapackagecom.example.activity05;importandroid.net.Uri;importandroid.os.Bundle;importandroid.app.Activity;importandroid.content.Intent;importandroid.view.Menu;importandroid.view.View;importandroid.vi
4、ew.View.OnClickListener;importandroid.widget.Button;publicclassMainActivityextendsActivity{privateButtonmybut=null;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);mybut=(Button)findViewById(R.
5、id.mybut);mybut.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubUriuri=Uri.parse("file:///sdcard/right.png");Intentit=newIntent();it.setAction(Intent.ACTION_SEND);it.putExtra("address","11111111111");it.putExtra("sms_bo
6、dy","北京魔乐科技软件学院");it.putExtra(Intent.EXTRA_STREAM,uri);it.setType("image/png");MainActivity.this.startActivity(it);}});}@OverridepublicbooleanonCreateOptionsMenu(Menumenu){//Inflatethemenu;thisaddsitemstotheactionbarifitispresent.getMenuInflater().inflate(R.menu.main,menu);r
7、eturntrue;}}
此文档下载收益归作者所有