<repo_name>sn94/IntentsAndroid<file_sep>/app/src/main/java/com/example/sonia/intentsandroid/MainActivity.java
package com.example.sonia.intentsandroid;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    ArrayList<Contacto> contactos;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        contactos= new ArrayList<Contacto>();
        contactos.add( new Contacto("Sonia","0983 129 494", "email1") );
        contactos.add( new Contacto("Sofia","0982 509 114", "email2") );
        contactos.add( new Contacto("Sandra","0973 129 004", "email3") );
        contactos.add( new Contacto("Samanta","0985 177 474", "email4") );
        contactos.add( new Contacto("Soledad","0983 129 321", "email5") );
        contactos.add( new Contacto("Susana","0993 130 822", "email6") );
        ArrayList<String> lstNombres= new ArrayList<String>();
        for(Contacto ite:contactos){
            lstNombres.add( ite.getNombre() );
        }
        final ListView lstContac= (ListView) findViewById(R.id.lst);
        lstContac.setAdapter(  
                new ArrayAdapter<String>(this, 
                        android.R.layout.simple_list_item_1, 
                        lstNombres));
        
        
        lstContac.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intento= new Intent( MainActivity.this, DetalleContacto.class );
                intento.putExtra("nombre", contactos.get(position).getNombre());
                intento.putExtra("telefono", contactos.get(position).getTelefono());
                intento.putExtra("email", contactos.get(position).getEmail());
                startActivity(   intento );
                //finish();//cerrar actividad
            }
        });
    }
    
    
    
}
<file_sep>/app/src/main/java/com/example/sonia/intentsandroid/DetalleContacto.java
package com.example.sonia.intentsandroid;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;

public class DetalleContacto extends AppCompatActivity {


    private TextView tnombre;
    private TextView ttelefono;
    private TextView temail;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detalle_contacto);


        Bundle dts = getIntent().getExtras();
        String nom = dts.getString("nombre");
        String tel = dts.getString("telefono");
        String email = dts.getString("email");

        tnombre = (TextView) findViewById(R.id.tvNombre);
        ttelefono = (TextView) findViewById(R.id.tvTelefono);
        temail = (TextView) findViewById(R.id.tvemail);
        tnombre.setText(nom);
        ttelefono.setText(tel);
        temail.setText(email);

    }


    public void do_call(View v) {
        String TXT = "tel:" + ttelefono.getText().toString();
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return;
        }
        startActivity(new Intent(Intent.ACTION_CALL, Uri.parse(TXT)));
    }
    
    
    public void sent_email(  View v){
        String email=  "mailto:"+temail.getText().toString();
        Intent intentEmail= new Intent( Intent.ACTION_SEND);
        intentEmail.setData(Uri.parse(email)); // el email como uri
        intentEmail.putExtra(Intent.EXTRA_EMAIL, email);//la direccion
        intentEmail.setType("message/rfc822");// tipo de envio
        startActivity(  Intent.createChooser(intentEmail , "Email "));
        
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        
       /* if( keyCode ==  KeyEvent.KEYCODE_BACK){
         Intent MENS= new Intent( this, MainActivity.class);
         startActivity( MENS);
        }*/
        return super.onKeyDown(keyCode, event);
    }
}
