/[projects]/android/SmsSend/src/dk/thoerup/smssend/SmsSend.java
ViewVC logotype

Diff of /android/SmsSend/src/dk/thoerup/smssend/SmsSend.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1136 by torben, Mon May 31 07:21:46 2010 UTC revision 1137 by torben, Mon Sep 27 05:44:28 2010 UTC
# Line 37  public class SmsSend extends Activity { Line 37  public class SmsSend extends Activity {
37                    
38          final int LOOKUP_PHONENR = 2000;          final int LOOKUP_PHONENR = 2000;
39                    
40            String respMessage;
41            
42    
43          @Override          @Override
44          public void onCreate(Bundle savedInstanceState) {          public void onCreate(Bundle savedInstanceState) {
# Line 243  public class SmsSend extends Activity { Line 245  public class SmsSend extends Activity {
245                  String pass = prefs.getString("coolpass", "");                  String pass = prefs.getString("coolpass", "");
246                                    
247                  if (user.equals("") || pass.equals("")) {                  if (user.equals("") || pass.equals("")) {
248                          Toast.makeText(this, "No username or password set!", Toast.LENGTH_LONG).show();                          respMessage = "No username or password set!";
249                          return false;                          return false;
250                  }                  }
251                                    
252                  if ( isNumeric(getFrom()) ) {                  if ( isNumeric(getFrom()) ) {
253                          Toast.makeText(this, "Can not send when 'from' equals a number\nmust add letters", Toast.LENGTH_LONG).show();                          respMessage = "Can not send when 'from' equals a number\nmust add letters";
254                          return false;                          return false;
255                  }                  }
256                                    
# Line 271  public class SmsSend extends Activity { Line 273  public class SmsSend extends Activity {
273                                    
274                                    
275                  boolean success = false;                  boolean success = false;
276                  String msg = "";  
277                  try {                  try {
278                          byte bytes[] = HttpUtil.postContent(url,  paramStr, 2500 );                          byte bytes[] = HttpUtil.postContent(url,  paramStr, 2500 );
279                          String res = new String(bytes);                          String res = new String(bytes);
280                          Map<String,String> vals = HttpUtil.decodeParams(res);                          Map<String,String> vals = HttpUtil.decodeParams(res);
281                                                    
282                          success = vals.get("status").equals("success");                          success = vals.get("status").equals("success");
283                          msg = vals.get("result");                          respMessage = vals.get("result");
284                                                    
285                  } catch (Exception e) {                  } catch (Exception e) {
286                          Log.e("SmsSend", "sendCoolSms", e);                          Log.e("SmsSend", "sendCoolSms", e);
# Line 381  public class SmsSend extends Activity { Line 383  public class SmsSend extends Activity {
383                                                    
384                          String msg = "Done!";                          String msg = "Done!";
385                          if (ret == false)                          if (ret == false)
386                                  msg = "failed!";                                  msg = respMessage;
387    
388                          Toast.makeText(SmsSend.this, msg, Toast.LENGTH_LONG).show();                          Toast.makeText(SmsSend.this, msg, Toast.LENGTH_LONG).show();
389                  }                  }

Legend:
Removed from v.1136  
changed lines
  Added in v.1137

  ViewVC Help
Powered by ViewVC 1.1.20