ユーザーが連絡先を選択して電話番号を取得させようとしています。 E/EGL_emulation:TID 5883:eglSurfaceAttrib(1165):エラー0x3009私がなぜが、ときに、ユーザーが連絡先を選択し、私は、次のエラーでアプリを押しつぶすを知らないhttps://developer.android.com連絡先の電話番号を取得するクラッシュ
//the onClick function for the user to pick his contact
public void pickContact(View view) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, REQUEST_SELECT_PHONE_NUMBER);
}
}
//the function that should retrieve the phone number
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_SELECT_PHONE_NUMBER && resultCode == RESULT_OK) {
// Get the URI and query the content provider for the phone number
Uri contactUri = data.getData();
ContentResolver resolver = getContentResolver();
String[] projection = new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER};
Cursor cursor = resolver.query(contactUri, projection, null, null, null);
// If the cursor returned is valid, get the phone number
if (cursor != null && cursor.moveToFirst()) {
int numberIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
String number = cursor.getString(numberIndex);
// Do something with the phone number
}
}
}
に次のコードを見つけました(EGL_BAD_MATCH)。デバッグから、それは、この行でクラッシュしているようです:
Cursor cursor = resolver.query(contactUri,
projection, null, null, null);
編集:logcatメッセージ:
03-07 11:16:53.239 5866から5883/com.example.roy.wakeapp I/OpenGLRenderer:初期化されたEGL、バージョン1.4 03-07 11:16:53.265 5866-5883/com.example.roy.wakeapp E/EGL_emulation:tid 5883:eglSurfaceAttrib(1165):エラー0x3009(EGL_BAD_MATCH) 03-07 11: 16:53.265 5866-5883/com.example.roy.wakeapp W/OpenGLRenderer:面0xad1ab480にEGL_SWAP_BEHAVIORを設定できませんでした。エラー= EGL_BAD_MATCH
それはうまくいくが、理由を見つけることができなかった。 誰かがその理由を知っている、またはそれを行うための別の方法を提供できる場合は、私はうれしいでしょう:)
ありがとう!
uはどのようなクラッシュを得ているが、次のように
Intent
をインスタンス化してみ? –ここに完全なスタックトレースを貼り付ける必要があります。 – Yashasvi
@ Yashasviどのように私は完全なstacktraceを取得するには? –