SHARE
TWEET

Untitled

a guest Aug 13th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.iavariav.layouting;
  2.  
  3. import android.os.Bundle;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.view.View;
  6. import android.widget.Button;
  7. import android.widget.TextView;
  8.  
  9. import com.iavariav.layouting.gmail.SendMailTask;
  10.  
  11. import java.util.Arrays;
  12. import java.util.List;
  13.  
  14. public class detail_Info_ID extends AppCompatActivity {
  15.     @Override
  16.     protected void onCreate(Bundle savedInstanceState) {
  17.         super.onCreate(savedInstanceState);
  18.         setContentView(R.layout.activity_detail__info__id);
  19.  
  20.  
  21.         // Objek
  22.         TextView nama = (TextView) findViewById(R.id.tvnama);
  23.         TextView alamat = (TextView) findViewById(R.id.tvalamat);
  24.         TextView jeniskelamin = (TextView) findViewById(R.id.tvkelamin);
  25.         TextView nik = (TextView) findViewById(R.id.tvnik);
  26.         TextView ttl = (TextView) findViewById(R.id.tvttl);
  27.         TextView agama = (TextView) findViewById(R.id.tvagama);
  28.         TextView hasil = (TextView) findViewById(R.id.log);
  29.         TextView subjek = (TextView) findViewById(R.id.subjek);
  30.  
  31.         //mengambil data dari Activity 1
  32.         Bundle b = getIntent().getExtras();
  33.         nik.setText(b.getCharSequence("nik"));
  34.         nama.setText(b.getCharSequence("nama"));
  35.         alamat.setText(b.getCharSequence("alamat"));
  36.         ttl.setText(b.getCharSequence("ttl"));
  37.         agama.setText(b.getCharSequence("agama"));
  38.         jeniskelamin.setText(b.getCharSequence("jeniskelamin"));
  39.  
  40.         subjek.setText("Hasil Percobaan Sahaja");
  41.         hasil.setText("NIK      : " + nik.getText().toString() + "\n" +
  42.                       "Nama     : " + nama.getText().toString() + "\n" +
  43.                       "Alamat   : " + alamat.getText().toString() + "\n" +
  44.                       "Tempat/Tgl Lahir : " + ttl.getText().toString() + "\n" +
  45.                       "Jenis Kelamin    : " + jeniskelamin.getText().toString());
  46.  
  47.  
  48.         final Button send = (Button) this.findViewById(R.id.kirim);
  49.         send.setOnClickListener(new View.OnClickListener() {
  50.             public void onClick(View v) {
  51.                 String fromEmail = ((TextView) findViewById(R.id.mail))
  52.                         .getText().toString();
  53.                 String fromPassword = ((TextView) findViewById(R.id.pwd))
  54.                         .getText().toString();
  55.                 String toEmails = ((TextView) findViewById(R.id.untuk))
  56.                         .getText().toString();
  57.                 List<String> toEmailList = Arrays.asList(toEmails
  58.                         .split("\\s*,\\s*"));
  59.                 String emailSubject = ((TextView) findViewById(R.id.subjek))
  60.                         .getText().toString();
  61.                 String emailBody = ((TextView) findViewById(R.id.log))
  62.                         .getText().toString();
  63.  
  64.                 //MENGHUBUNGKAN ANTARA JAVA HASIL DAN PENGIRIMAN EMAIL
  65.                 new SendMailTask(detail_Info_ID.this).execute(fromEmail, fromPassword, toEmailList, emailSubject, emailBody);
  66.             }
  67.         });
  68.  
  69.     }
  70.     }
RAW Paste Data
Top