답변 2개
8년 전
public static final int PICK_CONTACT = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// this opens the activity. note the Intent.ACTION_GET_CONTENT
// and the intent.setType
((Button)findViewById(R.id.btn_contacts)).setOnClickListener( new OnClickListener() {
@Override
public void onClick(View v) {
// user BoD suggests using Intent.ACTION_PICK instead of .ACTION_GET_CONTENT to avoid the chooser
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
// BoD con't: CONTENT_TYPE instead of CONTENT_ITEM_TYPE
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
startActivityForResult(intent, 1);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data != null) {
Uri uri = data.getData();
if (uri != null) {
Cursor c = null;
try {
c = getContentResolver().query(uri, new
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
8년 전
연락처 전화번호나 버튼이미지
위처럼 http://대신에">http://대신에 tel:해놓으시면 휴대폰에서 전화번호를 누르면 통화를 할건지 저장을 할건지 뜹니다.
sms:하시면 문자전송이 될겁니다. 이건 제가 써보질 않아서요.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 4개
�
비코즈
8년 전
�
나연가온아빠
8년 전
저의 한계입니다 ㅋㅋ
�
비코즈
8년 전
$data = '+11234567890';
if( preg_match( '/^\+\d(\d{3})(\d{3})(\d{4})$/', $data, $matches ) )
{
$result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
return $result;
}
서핑해서 갖고온 소스인데 이걸로 하면 될까요??ㅎㅎ
if( preg_match( '/^\+\d(\d{3})(\d{3})(\d{4})$/', $data, $matches ) )
{
$result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
return $result;
}
서핑해서 갖고온 소스인데 이걸로 하면 될까요??ㅎㅎ
�
나연가온아빠
8년 전
-.-;;; 머리가;; 아....프....
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
저장할때 양식이 비어나와서 ㅠㅠ...
북마크처럼 제목이 살아서 보여야하는데
방법이 없을까요~?