Il Forum è consultabile solo in modalità lettura. Per domande o consigli iscriviti al nostro GRUPPO FACEBOOK / COMMUNITY cliccando qui

android invio e-mail da activity

Discussione in 'Development' iniziata da Bazz, 8 Gen 2013.

  1. Bazz

    Bazz Worker Droid

    Iscritto:
    9 Ago 2012
    Messaggi:
    61
    "Mi Piace":
    1
    ciao
    sto cercando di inviare una mail da un'activity con contact picker premendo un bottone ,
    ho trovato il seguente esempio (Android Essentials: Using the Contact Picker) :

    Codice:
    
    		//prova invio mail 	
    		public void doLaunchContactPicker (View view) {  
    	        Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,Contacts.CONTENT_URI);  
    			startActivityForResult(contactPickerIntent, intero);  
    	    }  
    		
    
    il metodo doLaunchContact è associato al bottone ;
    per quanto provi a modificare la chiamata al metodo ottengo sempre un errore , es :

    public void doLaunchContactPicker (View view) . . . :
    Multiple markers at this line
    - Syntax error on token "(", ; expected
    - Syntax error on token ")", ; expected
    - void is an invalid type for the variable doLaunchContactPicker


    public int doLaunchContactPicker (View view) . . . :
    Multiple markers at this line
    - Syntax error on token "(", ; expected
    - Syntax error on token ")", ; expected
    - Illegal modifier for parameter doLaunchContactPicker; only final is permitted


    come devo fare ?
    grazie , ciao
     
  2. acer1629

    acer1629 Worker Droid

    Iscritto:
    22 Ago 2012
    Messaggi:
    113
    "Mi Piace":
    22
    Vedendo il link che hai postato risulta :

    private static final int CONTACT_PICKER_RESULT = 1001;
    public void doLaunchContactPicker(View view) {
    Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
    Contacts.CONTENT_URI);
    startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
    }


    Per cui ... immagino che debba rimanere void e all'interno della chiamata startActivityForResult debba esserci una variabile dichiarata come final.

    La tua variabile INTERO, è final ?
     
  3. Bazz

    Bazz Worker Droid

    Iscritto:
    9 Ago 2012
    Messaggi:
    61
    "Mi Piace":
    1
    no , scusa , il problema è che il metodo doLaunchContactPicker l'ho definito all'interno di un altro metodo (che sopra non si vede) ,
    ho spostato doLaunchContactPicker e l'errore è scomparso.. (mi hanno aiutato però..)
    grazie
    ciao