Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. package com.LinuxKidEX.service;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.app.PendingIntent;
  6. import android.content.BroadcastReceiver;
  7. import android.content.Context;
  8. import android.content.Intent;
  9. import android.content.IntentFilter;
  10. import android.telephony.SmsManager;
  11. import android.widget.Button;
  12. import android.widget.EditText;
  13. import android.view.KeyEvent;
  14. import android.view.View;
  15. import android.widget.Toast;
  16.  
  17. public class serv extends Activity
  18. implements View.OnKeyListener, View.OnClickListener{
  19.  
  20. Button sendBtn;
  21. EditText phoneFld;
  22. EditText msgFld;
  23.  
  24. /** Called when the activity is first created. */
  25. @Override
  26. public void onCreate(Bundle savedInstanceState) {
  27. super.onCreate(savedInstanceState);
  28. setContentView(R.layout.main);
  29.  
  30. sendBtn = (Button)findViewById(R.id.sendBtn);
  31. sendBtn.setOnClickListener(this);
  32.  
  33. phoneFld = (EditText)findViewById(R.id.numFld);
  34. phoneFld.setOnKeyListener(this);
  35. msgFld = (EditText)findViewById(R.id.msgFld);
  36. msgFld.setOnKeyListener(this);
  37. }
  38.  
  39. @Override
  40. public boolean onKey(View v, int keyCode, KeyEvent event) {
  41. // TODO Auto-generated method stub
  42. return false;
  43. }
  44.  
  45. @Override
  46. public void onClick(View v) {
  47. String phoneNum = phoneFld.getText().toString();
  48. String msg = msgFld.getText().toString();
  49.  
  50. Intent servInt = new Intent(this, smsserv.class);
  51. servInt.putExtra("MSG", msg);
  52. servInt.putExtra("NUM", phoneNum);
  53. startService(servInt);
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement