制作手机短信发送助手
2016-09-04 19:46
489 查看
制作布局界面
一个简单的手机助手需要三个界面
第一个是短信发送的主界面
其次是短信助手的显示界面
最后是TextView的界面
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="短信助手"
android:textColor="#ff0000"
android:textSize="28sp" />
<Button
android:onClick="selectSms"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="选择短信"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tv_content"
android:text="短信内容"
android:textColor="#00ff00"
android:textSize="22sp" />
</LinearLayout>
第二个的代码为
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
第三个代码为
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:text="haha"
android:textColor="#0000ff"
android:textSize="20sp"
android:layout_height="wrap_content" >
</TextView>
之后在mianAcctivity中填写代码
public class MainActivity
extends Activity {
private TextView
tv_content;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv_content = (TextView) findViewById(R.id.tv_content);
}
Public void fasong (View view ){
Intent intent (this,SecondActivity));
startActivityForResult(intent ,0);
}
protected void onActivityResult(int requestCode,
int resultCode, Intent data) {
If(data!=null){
String text = data.getStringExtra(“text”);
Tv_context.settext(text);
}
else{
tv_context.settext(“没有duanxin”);
}
super.onActivityResult(requestCode, resultCode, data);
}
之后在src中建立一个新的class
把他命名为SelectSMSActivity.java
Public void SelectSMSActivity extends Activity{
private TextView
tv;
private String[]
smscontents={"羊年大吉","羊年happy","哈哈哈
,新年快乐","新春快乐","天天发财","彩票中奖","^_^"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lv = (ListView) findViewById(R.id.lv);
setContentView(R.layout.activity_select_sms);
lv.setAdapter(newArrayAdapter<String>(this, R.layout.item_textview,
smscontents));
}
制作布局界面
一个简单的手机助手需要三个界面
第一个是短信发送的主界面
其次是短信助手的显示界面
最后是TextView的界面
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="短信助手"
android:textColor="#ff0000"
android:textSize="28sp" />
<Button
android:onClick="selectSms"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="选择短信"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tv_content"
android:text="短信内容"
android:textColor="#00ff00"
android:textSize="22sp" />
</LinearLayout>
第二个的代码为
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
第三个代码为
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:text="haha"
android:textColor="#0000ff"
android:textSize="20sp"
android:layout_height="wrap_content" >
</TextView>
之后在mianAcctivity中填写代码
public class MainActivity
extends Activity {
private TextView
tv_content;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv_content = (TextView) findViewById(R.id.tv_content);
}
Public void fasong (View view ){
Intent intent (this,SecondActivity));
startActivityForResult(intent ,0);
}
protected void onActivityResult(int requestCode,
int resultCode, Intent data) {
If(data!=null){
String text = data.getStringExtra(“text”);
Tv_context.settext(text);
}
else{
tv_context.settext(“没有duanxin”);
}
super.onActivityResult(requestCode, resultCode, data);
}
之后在src中建立一个新的class
把他命名为SelectSMSActivity.java
Public void SelectSMSActivity extends Activity{
private TextView
tv;
private String[]
smscontents={"羊年大吉","羊年happy","哈哈哈
,新年快乐","新春快乐","天天发财","彩票中奖","^_^"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lv = (ListView) findViewById(R.id.lv);
setContentView(R.layout.activity_select_sms);
lv.setAdapter(newArrayAdapter<String>(this, R.layout.item_textview,
smscontents));
}
一个简单的手机助手需要三个界面
第一个是短信发送的主界面
其次是短信助手的显示界面
最后是TextView的界面
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="短信助手"
android:textColor="#ff0000"
android:textSize="28sp" />
<Button
android:onClick="selectSms"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="选择短信"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tv_content"
android:text="短信内容"
android:textColor="#00ff00"
android:textSize="22sp" />
</LinearLayout>
第二个的代码为
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
第三个代码为
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:text="haha"
android:textColor="#0000ff"
android:textSize="20sp"
android:layout_height="wrap_content" >
</TextView>
之后在mianAcctivity中填写代码
public class MainActivity
extends Activity {
private TextView
tv_content;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv_content = (TextView) findViewById(R.id.tv_content);
}
Public void fasong (View view ){
Intent intent (this,SecondActivity));
startActivityForResult(intent ,0);
}
protected void onActivityResult(int requestCode,
int resultCode, Intent data) {
If(data!=null){
String text = data.getStringExtra(“text”);
Tv_context.settext(text);
}
else{
tv_context.settext(“没有duanxin”);
}
super.onActivityResult(requestCode, resultCode, data);
}
之后在src中建立一个新的class
把他命名为SelectSMSActivity.java
Public void SelectSMSActivity extends Activity{
private TextView
tv;
private String[]
smscontents={"羊年大吉","羊年happy","哈哈哈
,新年快乐","新春快乐","天天发财","彩票中奖","^_^"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lv = (ListView) findViewById(R.id.lv);
setContentView(R.layout.activity_select_sms);
lv.setAdapter(newArrayAdapter<String>(this, R.layout.item_textview,
smscontents));
}
制作布局界面
一个简单的手机助手需要三个界面
第一个是短信发送的主界面
其次是短信助手的显示界面
最后是TextView的界面
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="短信助手"
android:textColor="#ff0000"
android:textSize="28sp" />
<Button
android:onClick="selectSms"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="选择短信"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tv_content"
android:text="短信内容"
android:textColor="#00ff00"
android:textSize="22sp" />
</LinearLayout>
第二个的代码为
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
第三个代码为
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:text="haha"
android:textColor="#0000ff"
android:textSize="20sp"
android:layout_height="wrap_content" >
</TextView>
之后在mianAcctivity中填写代码
public class MainActivity
extends Activity {
private TextView
tv_content;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv_content = (TextView) findViewById(R.id.tv_content);
}
Public void fasong (View view ){
Intent intent (this,SecondActivity));
startActivityForResult(intent ,0);
}
protected void onActivityResult(int requestCode,
int resultCode, Intent data) {
If(data!=null){
String text = data.getStringExtra(“text”);
Tv_context.settext(text);
}
else{
tv_context.settext(“没有duanxin”);
}
super.onActivityResult(requestCode, resultCode, data);
}
之后在src中建立一个新的class
把他命名为SelectSMSActivity.java
Public void SelectSMSActivity extends Activity{
private TextView
tv;
private String[]
smscontents={"羊年大吉","羊年happy","哈哈哈
,新年快乐","新春快乐","天天发财","彩票中奖","^_^"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lv = (ListView) findViewById(R.id.lv);
setContentView(R.layout.activity_select_sms);
lv.setAdapter(newArrayAdapter<String>(this, R.layout.item_textview,
smscontents));
}
相关文章推荐
- C# Ajax 手机发送短信验证码 校验验证码 菜鸟级别实现方法
- SmartPhone开发常用类:手机发送短信
- 发送手机短信获取验证码功能
- java调接口实现发送手机短信验证码功能,手机验证码,接口调用
- 用C#写了一个新增用户就发送邮件和手机短信的SqlServer触发器
- 新增用户就发送邮件和手机短信
- 用C#写了一个新增用户就发送邮件和手机短信的SqlServer触发器(
- Java调用WebService接口实现发送手机短信验证码功能
- C# .net实现发送手机短信功能
- Android学习笔记(5)---模拟手机发送短信
- 使用J2ME发送手机短信
- java之网站发送手机短信实现
- [SMS&WAP]实例讲解制作OTA短信来自动配置手机WAP书签[附源码]
- 11/4.22 用OBJECT编写苹果手机发送短信的编程注定失败了。。。哎。。。
- [OTA]制作OTA短信来配置手机与服务器同步
- 一个Windows后台服务(.Net的C#版) - 定时访问数据库循环发送手机短信
- H5APP 调用手机短信发送界面
- 短信网关发送手机铃声和图片详解
- 转载 : 一个Windows后台服务(.Net的C#版) - 定时访问数据库循环发送手机短信
- 发送手机短信获取验证码功能