Возможно, кто-то может мне помочь. Я хотел бы передать две строки из другой деятельности. Это код, где я генерировать строки:Передача строк другой активности в Android
private void contactPicked(Intent data) {
Cursor cursor = null;
try {
String phoneNo = null;
String name = null;
// getData() method will have the Content Uri of the selected contact
Uri uri = data.getData();
//Query the content uri
cursor = getContentResolver().query(uri, null, null, null, null);
cursor.moveToFirst();
// column index of the phone number
int phoneIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
// column index of the contact name
int nameIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
phoneNo = cursor.getString(phoneIndex);
name = cursor.getString(nameIndex);
// Set the value to the textviews
textView1.setText(name);
textView2.setText(phoneNo);
} catch (Exception e) {
e.printStackTrace();
}
Я хотел бы передать PHONENO и имя моей MainActivity
Я пытался сделать SharedPreference и загружать DefaultSharedPreference в моем MainAcitivity без результата
Возможный дубликат [Как вы передаете данные/параметры на другой вид деятельности в Android] (http://stackoverflow.com/questions/6340423/how-do-you-pass-data-parameters- to-another-activity-in-android) – starkshang