Bonjour à tous!J
Je débute dans le développement Android, et j'ai un soucis!
Ce code en rouge marche trés bien sur Ubuntu, mais quand je l'utilise sur Android, j'ai droit à un joli "ClassNotFoundException".
Alors que j'utilise le même fichier dans les deux cas!
Quelqu'un a une idée?
Merci!

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.android.Gnealogy;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

import android.widget.TextView;
import android.widget.Toast;

public class Chargement {
	public static Arbre charger(String strPathFile, MainFrame main){
		Arbre chargerArbre = null;
		int i = 0;
		try {
			i = 0;
        	FileInputStream objFile= new FileInputStream(strPathFile);
        	i++;
        	ObjectInputStream ois= new ObjectInputStream(objFile);
        	i++;
            // désérialisation : lecture de l'objet depuis le flux d'entrée
                chargerArbre=  (Arbre) ois.readObject();
        	i++;
        	objFile.close();
        	i++;
        	ois.close();
        	i++;
        	TextView tv = new TextView(main);
        	tv.setText(chargerArbre.toString());
        	main.setContentView(tv);
        }
        catch (FileNotFoundException objError) {
        	Toast.makeText(main, "Fichier non trouvé\n"+objError.toString(), Toast.LENGTH_LONG).show();
        } catch (IOException e) {
        	Toast.makeText(main, "IOException\n"+e.toString(), Toast.LENGTH_LONG).show();
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
        	Toast.makeText(main,i+ "\nClassNotFoundException\n"+e.toString()+"\n"+e.getCause(), Toast.LENGTH_LONG).show();
			e.printStackTrace();
		}
		return chargerArbre;
	}
}