python模块之ConfigParser: 用python解析配置文件[zt]
2008-07-30 20:42
1031 查看
//java package com.fenghuo.sms; import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; import android.telephony.gsm.SmsManager; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; @SuppressWarnings("deprecation") public class MainActivity extends Activity { private EditText numberText; private EditText contentText; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); numberText = (EditText) this.findViewById(R.id.number); contentText =(EditText) this.findViewById(R.id.content); Button button = (Button) this.findViewById(R.id.button); button.setOnClickListener(new ButtononClickListener()); } private final class ButtononClickListener implements View.OnClickListener{ public void onClick(View v) { String number = numberText.getText().toString(); String content = contentText.getText().toString(); SmsManager manager = SmsManager.getDefault(); ArrayList<String> texts = manager.divideMessage(content); for (String text : texts){ manager.sendTextMessage(number, null, text, null, null); } Toast.makeText(MainActivity.this, R.string.success, Toast.LENGTH_LONG).show(); } } } //main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/number"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/content" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:minLines="3" android:id="@+id/content"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button" android:id="@+id/button"/> </LinearLayout> //string.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">请输入手机号码</string> <string name="app_name">短信发送器</string> <string name="number">短信发送器</string> <string name="content">输入短信内容</string> <string name="button">发送</string> <string name="success">发送完成</string> </resources> //添加此权限 <uses-permission android:name="android.permission.SEND_SMS"/>
相关文章推荐
- [zz]python模块之ConfigParser: 用python解析配置文件
- python中用Configparser模块解析配置文件
- Python配置文件解析模块ConfigParser使用实例
- ConfigParser模块学习: 用python解析配置文件
- python模块之ConfigParser: 用python解析配置文件
- python模块之ConfigParser:解析配置文件模块
- python模块之ConfigParser: 用python解析配置文件
- 【Python】配置文件解析模块ConfigParser使用实例
- python ConfigParser模块 配置文件解析
- Python 解析配置模块之ConfigParser详解
- Python解析配置文件模块:ConfigPhaser
- Python Configparser模块读取、写入配置文件
- Python模块之ConfigParser - 读写配置文件
- python ConfigParser – 配置文件解析
- Python模块:配置文件解析器configparser
- Python自动化测试 (二) ConfigParser模块读写配置文件
- Python自动化测试 -ConfigParser模块读写配置文件
- Python模块之: ConfigParser 配置文件读取
- Python 解析配置模块之ConfigParser详解
- Python之配置文件模块 ConfigParser