Android ArrayList in Application Class
I'm trying to pass arrayLists over the application class, but when filling these lists, I get a nullpointerexception even if lists are initialized. My application class is :

    public class appCyberesa extends Application{
    	
    	private ArrayList<Marchand> HProviders ;//= new ArrayList<Marchand>();
    	private ArrayList<CarAgency> CProviders ;//= new ArrayList<CarAgency>();
    	private ArrayList<Agency> Agencies ;//= new ArrayList<Agency>();
    	public GeoPoint Tunisie = new GeoPoint(microdegrees(36.80023),microdegrees(10.186073));
    	private GeoPoint myLoc;
    	
    	@Override
    	public void onCreate() {
    		
    		
    		
    	}
    		
    	private static int microdegrees(double value){
    		return (int)(value*1000000);
    	}
    
    	public void setMyLoc(GeoPoint myLoc) {
    		this.myLoc = myLoc;
    	}
    
    	public GeoPoint getMyLoc() {
    		return myLoc;
    	}
    
    	public void setHProviders(ArrayList<Marchand> hProviders) {
    		HProviders = new ArrayList<Marchand>();
    		HProviders.addAll(hProviders);
    	}
    
    	public ArrayList<Marchand> getHProviders() {
    		return HProviders;
    	}
    
    	public void setCProviders(ArrayList<CarAgency> cProviders) {
    		CProviders = new ArrayList<CarAgency>();
    		CProviders.addAll(cProviders);
    	}
    
    	public ArrayList<CarAgency> getCProviders() {
    		return CProviders;
    	}
    
    	public void setAgencies(ArrayList<Agency> agencies) {
    		Agencies = new ArrayList<Agency>();
    		Agencies.addAll(agencies);
    	}
    
    	public ArrayList<Agency> getAgencies() {
    		return Agencies;
    	}
    }

and the following is causing the NullPointerException :

    appCyberesa myApp = ((appCyberesa)this.getApplication());
    ...
    //the error occurs here
    myApp.setHProviders(Marchands);
    myApp.setCProviders(CarRenters);
    myApp.setAgencies(Agencies);


Please help me :(
Android ArrayList in Application Class
===

I'm trying to pass arrayLists over the application class, but when filling these lists, I get a nullpointerexception even if lists are initialized. My application class is :

    public class appCyberesa extends Application{
    	
    	private ArrayList<Marchand> HProviders ;//= new ArrayList<Marchand>();
    	private ArrayList<CarAgency> CProviders ;//= new ArrayList<CarAgency>();
    	private ArrayList<Agency> Agencies ;//= new ArrayList<Agency>();
    	public GeoPoint Tunisie = new GeoPoint(microdegrees(36.80023),microdegrees(10.186073));
    	private GeoPoint myLoc;
    	
    	@Override
    	public void onCreate() {
    		
    		
    		
    	}
    		
    	private static int microdegrees(double value){
    		return (int)(value*1000000);
    	}
    
    	public void setMyLoc(GeoPoint myLoc) {
    		this.myLoc = myLoc;
    	}
    
    	public GeoPoint getMyLoc() {
    		return myLoc;
    	}
    
    	public void setHProviders(ArrayList<Marchand> hProviders) {
    		HProviders = new ArrayList<Marchand>();
    		HProviders.addAll(hProviders);
    	}
    
    	public ArrayList<Marchand> getHProviders() {
    		return HProviders;
    	}
    
    	public void setCProviders(ArrayList<CarAgency> cProviders) {
    		CProviders = new ArrayList<CarAgency>();
    		CProviders.addAll(cProviders);
    	}
    
    	public ArrayList<CarAgency> getCProviders() {
    		return CProviders;
    	}
    
    	public void setAgencies(ArrayList<Agency> agencies) {
    		Agencies = new ArrayList<Agency>();
    		Agencies.addAll(agencies);
    	}
    
    	public ArrayList<Agency> getAgencies() {
    		return Agencies;
    	}
    }

and the following is causing the NullPointerException :

    appCyberesa myApp = ((appCyberesa)this.getApplication());
    ...
    //the error occurs here
    myApp.setHProviders(Marchands);
    myApp.setCProviders(CarRenters);
    myApp.setAgencies(Agencies);


Please help me :(