public void run() { try { Transport.send(message); } catch (Exception e) { Log.v("Internet connectionless", e.toString()); } }
public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception { try { message = new MimeMessage(session); DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain")); message.setSender(new InternetAddress(sender)); message.setSubject(subject); message.setDataHandler(handler); if (recipients.indexOf(',') > 0) message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients)); else message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients)); Thread Subthread = new Thread(mutiThread); // 開一個新的線程,去執行網路連線 Subthread.start(); } catch (Exception e) { Log.v("ErrorMail", e.toString()); } }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); TextView tv = (TextView) findViewById(R.id.textView); try { Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/gillsansmt.ttf"); tv.setTypeface(tf); } catch (Exception e) { Log.e("ERROR", e.toString()); } new Handler() .postDelayed( new Runnable() { @Override public void run() { checkUser(); } }, SPLASH_TIME); }