ANDROID APP
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
import android.preference.PreferenceManager;<br />
import android.util.Log;<br />
import android.view.View;<br />
import android.view.View.OnClickListener;<br />
import android.widget.Button;<br />
import android.widget.EditText;<br />
import android.widget.TextView;<br />
การใช้งาน SMS<br />
199<br />
public class SMSResponder extends Activity {<br />
TextView tv1;<br />
EditText ed1;<br />
Button bt1;<br />
SharedPreferences myprefs;<br />
Editor updater;<br />
String reply=null;<br />
@Override<br />
public void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
setContentView(R.layout.main);<br />
myprefs = PreferenceManager.getDefaultSharedPreferences(this);<br />
tv1 = (TextView) this.findViewById(R.id.display);<br />
ed1 = (EditText) this.findViewById(R.id.editText);<br />
bt1 = (Button) this.findViewById(R.id.submit);<br />
reply = myprefs.getString("reply",<br />
"Thank you for your message. I am busy now. "<br />
+ "I will call you later");<br />
tv1.setText(reply);<br />
updater = myprefs.edit();<br />
ed1.setHint(reply);<br />
bt1.setOnClickListener(new OnClickListener() {<br />
public void onClick(View view) {<br />
updater.putString("reply", ed1.getText().toString());<br />
updater.commit();<br />
SMSResponder.this.finish();<br />
}<br />
});<br />
try {<br />
// start Service<br />
Intent svc = new Intent(this, ResponderService.class);<br />
startService(svc);<br />
}