Bonjour, bonjour !

J'ai un code dans lequel s'ouvre un popup et l'user rentre ses valeurs, et à la suite de ceci je souhaiterais que ses valeurs s'affiche dans un TextView, le problèmes est que je ne sais pas comment faire pour crée un TextView dans le code directement, c'est à dire que s'il faut affiché qqch on l'affiche dans un TextView sinon il n'y a pas de TextVew.

Mon problème est que je ne sais pas auto générer un TextView ...

Voilà mon code :

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package com.pfsdroid.android;
 
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
 
 
public class PfsActivity extends Activity{
 
	EditText ComNbAme;
	Button ComDefAme;
	TextView ComScreen;
 
	private int VarNbAme;
 
	int VarFx;
	int VarFy;
	int VarFz;
	int VarMx;
	int VarMy;
	int VarMz;
	String VarPa = null;
 
	public void onCreate(Bundle savedInstanceState) 
	{
		 super.onCreate(savedInstanceState);
		 setContentView(R.layout.pfs);
 
		 ComDefAme = (Button) findViewById(R.id.ComDefAme);
		 ComNbAme = (EditText) findViewById(R.id.ComNbAme);
		 ComScreen = (TextView) findViewById(R.id.ComScreen);
 
		 ComDefAme.setOnClickListener(new View.OnClickListener() 
			{
				public void onClick(View view) 
					{
					 VarNbAme = Integer.parseInt(ComNbAme.getText().toString());
					 defAme();
					}
			});
	}
	private void defAme() 
	{
		if (VarNbAme == 2)
		{
			final View add_view=getLayoutInflater().inflate(R.layout.deux_ame, null);
 
			new AlertDialog.Builder(PfsActivity.this)
			.setTitle("PFS sous l'action de 2 forces :")
			.setIcon(android.R.drawable.ic_menu_directions)
			.setView(add_view)
			.setNegativeButton("Fin", null)
			.create()
			.show();
		}
		else if (VarNbAme == 3)
		{
			ComDefAme.setEnabled(false);	
			int i = 0;
			while (i != 3)
			{
				final View add_view=getLayoutInflater().inflate(R.layout.add, null);
 
				new AlertDialog.Builder(PfsActivity.this)
				.setTitle("Ajouter une Ame :")
				.setIcon(android.R.drawable.ic_menu_add)
				.setView(add_view)
				.setPositiveButton("Ajouter", new DialogInterface.OnClickListener(){
					public void onClick(DialogInterface dialog, int whichButton) 
					{		
		            	EditText ComFx = (EditText)add_view.findViewById(R.id.ComFx);
		            	EditText ComFy = (EditText)add_view.findViewById(R.id.ComFy);
		            	EditText ComFz = (EditText)add_view.findViewById(R.id.ComFz);
		            	EditText ComMx = (EditText)add_view.findViewById(R.id.ComMx);
		            	EditText ComMy = (EditText)add_view.findViewById(R.id.ComMy);
		            	EditText ComMz = (EditText)add_view.findViewById(R.id.ComMz);
		            	EditText ComPa = (EditText)add_view.findViewById(R.id.ComPa);
 
		            	VarFx = Integer.parseInt(ComFx.getText().toString());
		            	VarFy = Integer.parseInt(ComFy.getText().toString());
		            	VarFz = Integer.parseInt(ComFz.getText().toString());
		            	VarMx = Integer.parseInt(ComMx.getText().toString());
		            	VarMy = Integer.parseInt(ComMy.getText().toString());
		            	VarMz = Integer.parseInt(ComMz.getText().toString());
		            	VarPa = ComPa.getText().toString();
 
					}
				})
				.setNegativeButton("Annuler", null)
				.create()
				.show();
				Ame declare = new Ame(i, VarFx, VarFy, VarFz, VarMx, VarMy, VarMz, VarPa);
				declare.Affichage();
				i++;
			}
		}
		else 
		{
			final View add_view=getLayoutInflater().inflate(R.layout.ereur_ame, null);
 
			new AlertDialog.Builder(PfsActivity.this)
			.setTitle("Impossible :")
			.setIcon(android.R.drawable.ic_menu_help)
			.setView(add_view)
			.setNegativeButton("Fin", null)
			.create()
			.show();
		}
	}
}
et ma classe Ame :

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
44
45
package com.pfsdroid.android;

import android.widget.TableRow;
import android.widget.TextView;

public class Ame 
{
	int id;
	int Fx;
	int Fy;
	int Fz;
	int Mx;
	int My;
	int Mz;
	String Pa;
	
	 public Ame()
	 {
        
		 	id = 0;
			Fx = 0;
			Fy = 0;
			Fz = 0;
			Mx = 0;
			My = 0;
			Mz = 0;
			Pa = "x";
 }

	 public Ame(int pId, int pFx, int pFy, int pFz, int pMx, int pMy, int pMz, String pPa)
	  {     
	          id = pId;
	          Fx = pFx;
			  Fy = pFy;
			  Fz = pFz;
			  Mx = pMx;
			  My = pMy;
		      Mz = pMz;
		      Pa = pPa;
	  }
	 public void Affichage()
	  {     
		//C'est ici que je bloque ... 
	  }
}

Merci de votre aide !

Flyer-74