Bonjour à tous,
j'ai un code sous android, et via ce code, je veux modifier un enregistrement dans la base de données SQLite
le code est le suivant
ce code ne génére pas des erreurs de compilation, sauf que pour l'exécution, il me génére les erreurs suivantes :
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 import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Modif1_corresp extends Activity implements OnClickListener{ EditText edit1,edit2,edit3,edit4,edit5,edit6,edit7; DBAdapter db; Button button1,button2; public int updateCorrespondant(int id, String nom,String prenom,String telephone,String mail,String adresse, String gouvernerat,String fonction ) { ContentValues values = new ContentValues(); values.put("nom", nom); values.put("prenom", prenom); values.put("telephone", telephone); values.put("mail", mail); values.put("adresse", adresse); values.put("gouvernerat", gouvernerat); values.put("fonction", fonction); return db.update(TABLE_corresp, values, "_id="+id,null); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.modif_corresp); edit1= ((EditText)this.findViewById(R.id.editText1)); edit2= ((EditText)this.findViewById(R.id.editText2)); edit3= ((EditText)this.findViewById(R.id.editText3)); edit4= ((EditText)this.findViewById(R.id.editText4)); edit5= ((EditText)this.findViewById(R.id.editText5)); edit6= ((EditText)this.findViewById(R.id.editText6)); edit7= ((EditText)this.findViewById(R.id.editText7)); button1= ((Button)this.findViewById(R.id.button1)); button2= ((Button)this.findViewById(R.id.button2)); button1.setOnClickListener(this); button2.setOnClickListener(this); Intent thisIntent = getIntent(); long id_ = thisIntent.getExtras().getInt("_id"); String nom = thisIntent.getExtras().getString("nom"); String prenom = thisIntent.getExtras().getString("prenom"); String telephone = thisIntent.getExtras().getString("telephone"); String mail = thisIntent.getExtras().getString("mail"); String adresse = thisIntent.getExtras().getString("adresse"); String gouvernerat = thisIntent.getExtras().getString("gouvernerat"); String fonction = thisIntent.getExtras().getString("fonction"); edit1.setText(nom); edit2.setText(prenom); edit3.setText(telephone); edit4.setText(mail); edit5.setText(adresse); edit6.setText(gouvernerat); edit7.setText(fonction); } public void onClick(View v) { if(v==button1){ Intent thisIntent = getIntent(); int id_ = thisIntent.getExtras().getInt("_id"); String nom_ = edit1.getText().toString(); String prenom_ = edit2.getText().toString(); String telephone_ = edit3.getText().toString(); String mail_ = edit4.getText().toString(); String adresse_ = edit5.getText().toString(); String gouvernerat_ = edit6.getText().toString(); String fonction_ = edit7.getText().toString(); db.updateCorrespondant(id_, nom_, prenom_, telephone_, mail_, adresse_, gouvernerat_, fonction_); } if(v==button2){ Intent intent=new Intent (Modif1_corresp.this,Modif_corresp.class); this.startActivityForResult(intent, 1000); } } }
Le fichier manifest.xml est le suivant :
05-19 17:27:25.087: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
05-19 17:27:25.087: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test2' (m)
05-19 17:27:25.087: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
05-19 17:27:25.087: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test' (m)
05-19 17:27:25.257: ERROR/flash_image(544): can't find recovery partition
05-19 17:27:43.508: ERROR/MemoryHeapBase(562): error opening /dev/pmem: No such file or directory
05-19 17:27:43.508: ERROR/SurfaceFlinger(562): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
05-19 17:27:43.668: ERROR/GLLogger(562): couldn't load <libhgl.so> library (Cannot find library)
05-19 17:27:43.807: ERROR/GLLogger(562): couldn't load <libhgl.so> library (Cannot find library)
05-19 17:27:47.907: ERROR/BatteryService(562): Could not open '/sys/class/power_supply/usb/online'
05-19 17:27:47.917: ERROR/BatteryService(562): Could not open '/sys/class/power_supply/battery/batt_vol'
05-19 17:27:47.917: ERROR/BatteryService(562): Could not open '/sys/class/power_supply/battery/batt_temp'
05-19 17:27:48.717: ERROR/EventHub(562): could not get driver version for /dev/input/mouse0, Not a typewriter
05-19 17:27:48.808: ERROR/EventHub(562): could not get driver version for /dev/input/mice, Not a typewriter
05-19 17:27:48.937: ERROR/System(562): Failure starting core service
05-19 17:27:48.937: ERROR/System(562): java.lang.SecurityException
05-19 17:27:48.937: ERROR/System(562): at android.os.BinderProxy.transact(Native Method)
05-19 17:27:48.937: ERROR/System(562): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
05-19 17:27:48.937: ERROR/System(562): at android.os.ServiceManager.addService(ServiceManager.java:72)
05-19 17:27:48.937: ERROR/System(562): at com.android.server.ServerThread.run(SystemServer.java:163)
05-19 17:27:48.947: ERROR/AndroidRuntime(562): Crash logging skipped, no checkin service
05-19 17:27:50.378: ERROR/LockPatternKeyguardView(562): Failed to bind to GLS while checking for account
05-19 17:27:55.428: ERROR/ApplicationContext(562): Couldn't create directory for SharedPreferences file shared_prefs/wallpaper-hints.xml
05-19 17:28:01.310: ERROR/ActivityThread(609): Failed to find provider info for android.server.checkin
05-19 17:28:04.020: ERROR/ActivityThread(609): Failed to find provider info for android.server.checkin
05-19 17:28:04.140: ERROR/ActivityThread(609): Failed to find provider info for android.server.checkin
05-19 17:28:05.041: ERROR/MediaPlayerService(542): Couldn't open fd for content://settings/system/notification_sound
05-19 17:28:05.051: ERROR/MediaPlayer(562): Unable to to create media player
05-19 17:28:31.837: ERROR/SurfaceFlinger(562): not enough memory for layer bitmap size=307200
05-19 17:28:31.837: ERROR/SurfaceFlinger(562): createNormalSurfaceLocked() failed (Out of memory)
05-19 17:29:25.117: ERROR/AndroidRuntime(728): Uncaught handler: thread main exiting due to uncaught exception
05-19 17:29:25.147: ERROR/AndroidRuntime(728): java.lang.NullPointerException
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at com.formation.cimsp.Modif1_corresp.onClick(Modif1_corresp.java:110)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.View.performClick(View.java:2179)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.View.onTouchEvent(View.java:3828)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.widget.TextView.onTouchEvent(TextView.java:6291)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.View.dispatchTouchEvent(View.java:3368)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1197)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.app.Activity.dispatchTouchEvent(Activity.java:1993)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.os.Handler.dispatchMessage(Handler.java:99)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.os.Looper.loop(Looper.java:123)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at android.app.ActivityThread.main(ActivityThread.java:3948)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at java.lang.reflect.Method.invokeNative(Native Method)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at java.lang.reflect.Method.invoke(Method.java:521)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
05-19 17:29:25.147: ERROR/AndroidRuntime(728): at dalvik.system.NativeStart.main(Native Method)
merci de m'aider sur ce probléme
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 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:gravity="center_vertical" android:background="@drawable/run"> <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Nom:" /> <EditText android:id="@+id/editText1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20sp" android:background="@android:drawable/editbox_background" /> <TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Prénom:" /> <EditText android:id="@+id/editText2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background" android:textSize="20sp"/> <TextView android:id="@+id/textView3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Telephone:" /> <EditText android:id="@+id/editText3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20sp" android:background="@android:drawable/editbox_background" /> <TextView android:id="@+id/textView4" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="E-mail:" /> <EditText android:id="@+id/editText4" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20sp" android:background="@android:drawable/editbox_background" /> <TextView android:id="@+id/textView5" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Adresse:" /> <EditText android:id="@+id/editText5" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background" android:textSize="20sp"/> <TextView android:id="@+id/textView6" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Gouvernerat:" /> <EditText android:id="@+id/editText6" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20sp" android:background="@android:drawable/editbox_background" /> <TextView android:id="@+id/textView7" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Fonction:" /> <EditText android:id="@+id/editText7" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20sp" android:background="@android:drawable/editbox_background" /> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="2"> <TableRow> <Button android:id="@+id/button1" android:layout_width="160sp" android:layout_height="wrap_content" android:text="Modifier" /> <Button android:id="@+id/button2" android:layout_width="160sp" android:layout_height="wrap_content" android:text="Annuler" /> </TableRow> </TableLayout> </LinearLayout>
Partager