Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1673 connectés 

  FORUM HardWare.fr
  Programmation
  Android

  Problème intent.putExtra

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Problème intent.putExtra

n°2270002
heyguadah
Posté le 20-11-2015 à 10:19:34  profilanswer
 

Bonjour amis développeurs !
 
J'ouvre un petit post aujourd'hui car j'aurais besoin d'un petit conseil.
 
J'ai créé une classe user dans une application. Cette classe sera remplit au fur et à mesure des activité qui la compose pour finalement être affiché dans la dernière activité.
 
Pour la création de la classe, tous c'est très bien passé mais j'ai un petit soucis dans le intent.putExtra de mes activités...
 
Je vous montre mes petits bouts de codes.
 
 
 
La classe User
 

Spoiler :

package com.example.shiin.loginregisteralpha;
 
import android.os.Parcel;
import android.os.Parcelable;
 
public class User
{
    private String mName;
    private String mFirstName;
    private String mDate;
    private String mSexe;
    private String mMdp;
    private String mMail;
    private String mSexeFind;
    private String mCity;
    private String mCountry;
    private String mCountryId;
 
 
    public User(String Name, String FirstName,
                String Date, String Sexe, String Mdp,
                String Mail, String SexeFind, String City, String Country, String CountryId)
    {
        super();
        this.mName = Name;
        this.mFirstName = FirstName;
        this.mDate = Date;
        this.mSexe = Sexe;
        this.mMdp = Mdp;
        this.mMail = Mail;
        this.mSexeFind = SexeFind;
        this.mCity = City;
        this.mCountry = Country;
        this.mCountryId = CountryId;
    }
 
    public User(Parcel in) {
        this.mName = in.readString();
        this.mFirstName = in.readString();
        this.mDate = in.readString();
        this.mSexe = in.readString();
        this.mMdp = in.readString();
        this.mMail = in.readString();
        this.mSexeFind = in.readString();
        this.mCity = in.readString();
        this.mCountry = in.readString();
        this.mCountryId = in.readString();
    }
 
    public int describeContents()
    {
        return 0;
    }
 
    public void writeToParcel(Parcel dest, int flags)
    {
        dest.writeString(mName);
        dest.writeString(mFirstName);
        dest.writeString(mDate);
        dest.writeString(mSexe);
        dest.writeString(mMdp);
        dest.writeString(mMail);
        dest.writeString(mSexeFind);
        dest.writeString(mCity);
        dest.writeString(mCountry);
        dest.writeString(mCountryId);
    }
 
    public static final Parcelable.Creator<User> CREATOR = new Parcelable.Creator<User>()
    {
        @Override
        public User createFromParcel(Parcel source)
        {
            return new User(source);
        }
 
        @Override
        public User[] newArray(int size)
        {
            return new User[size];
        }
    };
 
    public String getmName()
    {
        return mName;
    }
 
    public String getmFirstName()
    {
        return mFirstName;
    }
 
    public String gemDate()
    {
        return mDate;
    }
 
    public String getmSexe()
    {
        return mSexe;
    }
 
    public String getmMdp()
    {
        return mMdp;
    }
 
    public String getmMail()
    {
        return mMail;
    }
 
    public String getmSexeFind()
    {
        return mSexeFind;
    }
 
    public String getmCity()
    {
        return mCity;
    }
 
    public String getmCountry()
    {
        return mCountry;
    }
 
    public String getmCountryId()
    {
        return mCountryId;
    }
 
    public static Parcelable.Creator<User> getCreator()
    {
        return CREATOR;
    }
 
 
}


 
 
Le fragment d'envoie de donnée de mon activité d'envoi
 
               

Spoiler :

User user = new User(name, firstname, null, null, null, null, null, null, null, null);
                Intent intent = new Intent(getApplicationContext(), RegisterBirth.class);
                intent.putExtra("user", user);
                startActivity(intent);


 
 
Le code d'erreur
 

Spoiler :

Error:(38, 23) error: no suitable method found for putExtra(String,User)
method Intent.putExtra(String,boolean) is not applicable
(argument mismatch; User cannot be converted to boolean)
method Intent.putExtra(String,byte) is not applicable
(argument mismatch; User cannot be converted to byte)
method Intent.putExtra(String,char) is not applicable
(argument mismatch; User cannot be converted to char)
method Intent.putExtra(String,short) is not applicable
(argument mismatch; User cannot be converted to short)
method Intent.putExtra(String,int) is not applicable
(argument mismatch; User cannot be converted to int)
method Intent.putExtra(String,long) is not applicable
(argument mismatch; User cannot be converted to long)
method Intent.putExtra(String,float) is not applicable
(argument mismatch; User cannot be converted to float)
method Intent.putExtra(String,double) is not applicable
(argument mismatch; User cannot be converted to double)
method Intent.putExtra(String,String) is not applicable
(argument mismatch; User cannot be converted to String)
method Intent.putExtra(String,CharSequence) is not applicable
(argument mismatch; User cannot be converted to CharSequence)
method Intent.putExtra(String,Parcelable) is not applicable
(argument mismatch; User cannot be converted to Parcelable)
method Intent.putExtra(String,Parcelable[]) is not applicable
(argument mismatch; User cannot be converted to Parcelable[])
method Intent.putExtra(String,Serializable) is not applicable
(argument mismatch; User cannot be converted to Serializable)
method Intent.putExtra(String,boolean[]) is not applicable
(argument mismatch; User cannot be converted to boolean[])
method Intent.putExtra(String,byte[]) is not applicable
(argument mismatch; User cannot be converted to byte[])
method Intent.putExtra(String,short[]) is not applicable
(argument mismatch; User cannot be converted to short[])
method Intent.putExtra(String,char[]) is not applicable
(argument mismatch; User cannot be converted to char[])
method Intent.putExtra(String,int[]) is not applicable
(argument mismatch; User cannot be converted to int[])
method Intent.putExtra(String,long[]) is not applicable
(argument mismatch; User cannot be converted to long[])
method Intent.putExtra(String,float[]) is not applicable
(argument mismatch; User cannot be converted to float[])
method Intent.putExtra(String,double[]) is not applicable
(argument mismatch; User cannot be converted to double[])
method Intent.putExtra(String,String[]) is not applicable
(argument mismatch; User cannot be converted to String[])
method Intent.putExtra(String,CharSequence[]) is not applicable
(argument mismatch; User cannot be converted to CharSequence[])
method Intent.putExtra(String,Bundle) is not applicable
(argument mismatch; User cannot be converted to Bundle)


Ça risque peut-être de vous sembler élémentaires mais je tourne en rond depuis plusieurs heures, je pense passer à coté de quelque chose....
 
Merci d'avance pour vos réponses !
 
 

mood
Publicité
Posté le 20-11-2015 à 10:19:34  profilanswer
 

n°2270193
souk
Tourist
Posté le 24-11-2015 à 09:00:31  profilanswer
 

Ta classe User n'implemente pas Parcelable ?


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Android

  Problème intent.putExtra

 

Sujets relatifs
problème whileProblème d'impression de fichier html contenant un saut de page
Problème bouton menu mobile[JAVA]probleme de bouton personnaliser.
[JQUERY]Problème requête ajax en GET via PHPproblème TRIGGER
Problème enregistrement de fichierProbleme JFrame Load .Jar Externe
[Résolu][WebServices&Ajax]problème de connexion juste avec ajaxProbleme d'affichage de mes enregistrements
Plus de sujets relatifs à : Problème intent.putExtra


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR