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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| package com.cpg.Aurel;
import java.io.*;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
public class ParcoursActivity extends Activity {
private String Filename;
private parcours parcours;
private EditText Nom;
private EditText NbPoints;
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
parcours=new parcours();
Intent intent= new Intent(this, C_Points.class);
intent.getExtras();
startActivity(intent);
Filename = intent.getExtras().getString("Filename");
//LectureFile(Filename);
setContentView(R.layout.main2);
Nom = (EditText)findViewById(R.id.editText1);
NbPoints = (EditText)findViewById(R.id.editText2);
Nom.setText(parcours.NomParcours);
NbPoints.setText(parcours.NbPoints);
}
public void LectureFile(String Filename)
{
try{
String Line="";
String[] Tab;
String Filepath = "sdcard/CPG/"+Filename;
Tab = new String [3];
BufferedReader Buffer = new BufferedReader(new FileReader(Filepath));
Line=Buffer.readLine();
Tab=Line.split(";");
parcours.NomParcours=Tab[0];
parcours.NbPoints=Integer.parseInt(Tab[1]);
for(int a = 0; a<parcours.NbPoints; a++)
{
Line=Buffer.readLine();
Tab=Line.split(";");
parcours.Points[a] = new C_Points();
parcours.Points[a].NomP = Tab[0];
parcours.Points[a].Latitude=Double.parseDouble(Tab[1]);
parcours.Points[a].Longitude=Double.parseDouble(Tab[2]);
}
Buffer.close();
}catch (Exception e){
}
}
} |
Partager