Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. new Thread(new Runnable() {
  2. @Override
  3. public void run() {
  4.  
  5. for(int i=0; i<brVozaca; i++){
  6. String smsTura = "Tura: " + nazivPocetne + " - " + nazivKrajnje +
  7. ", datum: " + datum;
  8. String smsNapomena = " Napomena: " + strNapomena;
  9. String smsVozaci = "";
  10.  
  11. for(int k=0; k<brVozaca-1; k++)
  12. smsVozaci += vozaci[k].vratiIme() + ", ";
  13. smsVozaci += vozaci[brVozaca - 1].vratiIme();
  14.  
  15. String smsText = smsTura + smsNapomena + " " + smsVozaci;
  16.  
  17. Log.e("smsText", smsText);
  18.  
  19. smsSend(vozaci[i].vratiTelefon(), smsTura, vozaci[i].vratiIme());
  20. smsSend(vozaci[i].vratiTelefon(), smsNapomena, vozaci[i].vratiIme());
  21. if(brVozaca > 1)
  22. smsSend(vozaci[i].vratiTelefon(), smsVozaci, vozaci[i].vratiIme());
  23. }
  24. }
  25.  
  26. Intent intent = new Intent(SendActivity.this, StartActivity.class);
  27. startActivity(intent);
  28. }// run()
  29.  
  30. private void smsSend(String broj, String poruka, String Ime){
  31. SmsManager sms = SmsManager.getDefault();
  32. ime = Ime;
  33.  
  34. try{
  35. sms.sendTextMessage(broj, null, poruka, null, null);
  36. }
  37. catch(IllegalArgumentException e){
  38. Log.e("SMS greška", e.getMessage().toString());
  39. }
  40. catch(Exception e){
  41. Log.e("SMS Exception", e.getMessage().toString());
  42. }
  43. }// end void smsSend()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement