Android Open Source - SmsAutoAnswer Main Activity

From Project

Back to project page SmsAutoAnswer.


The source code is released under:

MIT License

If you think the Android project SmsAutoAnswer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.autosms;
//from  ww w  .jav  a2s.  c o  m
import android.os.Bundle;
import android.telephony.SmsManager;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {
  private Button btnDisplay;

  protected void onCreate(Bundle savedInstanceState) {

  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(, menu);
    return true;

  public void addListenerOnButton() {
    btnDisplay = (Button) findViewById(;
    btnDisplay.setOnClickListener(new OnClickListener() {

      public void onClick(View arg0) {
        Log.v("button", "test");
        boolean activated=SmsReceiver.changeStatus();
        Toast.makeText(MainActivity.this, (activated)?"On" : "Off", Toast.LENGTH_SHORT).show();

Java Source Code List