@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); addNewContact.setTextVisibility(View.VISIBLE); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = null; String picturePath = null; try { cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); picturePath = cursor.getString(columnIndex); } catch (Exception e) { Log.d(TAG, "read directory exceprion"); } finally { if (cursor != null) { cursor.close(); } } if (picturePath != null) { updateContactItemByValue(picturePath); } } else { addNewContact.reset(); } }
private void updateContactItemByResource() { addNewContact.setContactName(R.string.new_name); addNewContact.setContactNameColorByResource(R.color.white); addNewContact.setContactImageBackground(R.drawable.ic_launcher); }
private void initAddNewContact() { addNewContact = new AddNewContact(this); addNewContact.setInternalReactionOnClick(AddNewContact.ON_CLICK_BEHAVIOR_SHOW); // for hide animation // addNewContact.setExternalAnimationListener(this); }
private void updateContactItemByValue(String picturePath) { addNewContact.setNewContactAdd( getResources().getString(R.string.new_name), Color.WHITE, picturePath); }