Bonjour,


Je reçois le message d'erreur suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
The method updateString(int, String) is undefined for the type Cursor
Voici le code, s'il vous plaît m'aider à comprendre où je me trompe?

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
package android_programmers_guide.FindAFriend;
import android_programmers_guide.FindAFriend.Friends;
import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


public class NameEditor extends Activity implements View.OnClickListener {
public static final String EDIT_NAME_ACTION = "android_programmers_guide.FindAFriend.action.EDIT_NAME";
private static final int NAME_INDEX = 1;
private static final String[] PROJECTION = new String[] {
Friends.Friend._ID,
Friends.Friend.NAME,
};
Cursor mCursor;
EditText mText;


@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.name_editor);
Uri uri = getIntent().getData();
mCursor = managedQuery(uri, PROJECTION, null, null, null);
mText = (EditText) this.findViewById(R.id.name);
mText.setOnClickListener(this);
Button b = (Button) findViewById(R.id.ok);
b.setOnClickListener(this);
}
@Override
protected void onResume() {
super.onResume();
if (mCursor != null) {
mCursor.isFirst(); //**  isFirst c'est une méthode qui retourne si le curseur est pointé sur la première rangée.
String title = mCursor.getString(NAME_INDEX);
mText.setText(title);
}
}
@Override
protected void onPause() {
super.onPause();
if (mCursor != null) {
String title = mText.getText().toString();
mCursor.updateString(NAME_INDEX, title);
mCursor.commitUpdates();
}
}
public void onClick(View v) {
finish();
}
}