bonjour

pour construire de beaux tableaux j'ai voulu prendre l'exellent exemple sur le code qu'on trouve ici :

http://javamind-fr.blogspot.fr/2012/...u-comment.html

et j'ai donc commencé à modifier mon code java comme ça :

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
package chauffagiste.mobile;
 
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.TableRow.LayoutParams;
 
 
//public class TableJavaFragment extends Fragment { 
 
public class CalcultableCompteurGaz extends Activity {
 
	private TableLayout containerTable;	
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.newfile);
		containerTable = (TableLayout) findViewById(R.id.containerTable);
		// Recuperation du table layout sur lequel nous allons agir
		String[] players = getResources().getStringArray(R.array.CompteurGaz);	
 
// Ca plante ici !!!!!	
		TableRow tableRow = new TableRow(getActivity());
 
 
	    }

et voila le retour sur l'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
01-03 07:57:37.066: E/AndroidRuntime(1144): FATAL EXCEPTION: main 01-03 07:57:37.066: E/AndroidRuntime(1144): java.lang.RuntimeException: Unable to start activity ComponentInfo{chauffagiste.mobile/chauffagiste.mobile.CalcultableCompteurGaz}: java.lang.NullPointerException 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.app.ActivityThread.access$600(ActivityThread.java:123) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.os.Handler.dispatchMessage(Handler.java:99) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.os.Looper.loop(Looper.java:137) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.app.ActivityThread.main(ActivityThread.java:4424) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at java.lang.reflect.Method.invokeNative(Native Method) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at java.lang.reflect.Method.invoke(Method.java:511) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at dalvik.system.NativeStart.main(Native Method) 01-03 07:57:37.066: E/AndroidRuntime(1144): Caused by: java.lang.NullPointerException 01-03 07:57:37.066: E/AndroidRuntime(1144): 	at android.view.ViewConfiguration.get(ViewConfiguration.java:331)
pouvez vous m"aider please ?

merci d'avance