-
-
Save Jamesits/8712294 to your computer and use it in GitHub Desktop.
adb_sms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
以下是MainActivity.java的内容 | |
建议在第34行之后加一句 this.finish(); | |
*/ | |
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
TextView t_n = (TextView) findViewById(R.id.target_num_text); | |
TextView m_b = (TextView) findViewById(R.id.msg_body_text); | |
TextView i_a = (TextView) findViewById(R.id.is_send); | |
String target_num=""; | |
String msg_body=""; | |
Bundle extras = getIntent().getExtras(); | |
if (extras != null) { | |
target_num = extras.getString("target_num"); | |
msg_body = extras.getString("msg_body"); | |
t_n.setText(target_num); | |
m_b.setText(msg_body); | |
} | |
if (!target_num.equals("")){ | |
SmsManager smsManager = SmsManager.getDefault(); | |
smsManager.sendTextMessage(target_num, null, msg_body, | |
null, null); | |
i_a.setText("我了个去好像发出去了"); | |
}else{ | |
i_a.setText("啥都没有发个毛线啊"); | |
} | |
} | |
} | |
/* | |
以下是activity_main.xml主界面布局的内容 | |
*/ | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/LinearLayout1" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
tools:context=".MainActivity" > | |
<TextView | |
android:id="@+id/textView1" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="target_num:" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/target_num_text" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_margin="10dp" | |
android:text="null" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/textView3" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="msg_body:" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/msg_body_text" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_margin="10dp" | |
android:text="null" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/is_send" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
以下是MainActivity.java的内容 | |
建议在第34行之后加一句 this.finish(); | |
*/ | |
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
TextView t_n = (TextView) findViewById(R.id.target_num_text); | |
TextView m_b = (TextView) findViewById(R.id.msg_body_text); | |
TextView i_a = (TextView) findViewById(R.id.is_send); | |
String target_num=""; | |
String msg_body=""; | |
Bundle extras = getIntent().getExtras(); | |
if (extras != null) { | |
target_num = extras.getString("target_num"); | |
msg_body = extras.getString("msg_body"); | |
t_n.setText(target_num); | |
m_b.setText(msg_body); | |
} | |
if (!target_num.equals("")){ | |
SmsManager smsManager = SmsManager.getDefault(); | |
smsManager.sendTextMessage(target_num, null, msg_body, | |
null, null); | |
i_a.setText("我了个去好像发出去了"); | |
}else{ | |
i_a.setText("啥都没有发个毛线啊"); | |
} | |
} | |
} | |
/* | |
以下是activity_main.xml主界面布局的内容 | |
*/ | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/LinearLayout1" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
tools:context=".MainActivity" > | |
<TextView | |
android:id="@+id/textView1" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="target_num:" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/target_num_text" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_margin="10dp" | |
android:text="null" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/textView3" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="msg_body:" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/msg_body_text" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_margin="10dp" | |
android:text="null" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<TextView | |
android:id="@+id/is_send" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
</LinearLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment