테스트 사이트 - 개발 중인 베타 버전입니다

PC에서 BOOK마크저장과 같이 모바일에서 클릭으로 핸드폰번호를 연락처에 저장할수있을까요? 채택완료

비코즈 8년 전 조회 5,867

내용 그대로 입니다~~!

 

PC에선 북마크버튼을 누르면 북마크에 저장되잖아요~

 

근데 모바일 화면에서 버튼을 누르면 휴대폰 번호가 상대방의 연락처에 저장되게 할 방법이

 

있을까요?

 

댓글을 작성하려면 로그인이 필요합니다.

답변 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 
                                        
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

연락처 전화번호나 버튼이미지

 

위처럼 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;
}

서핑해서 갖고온 소스인데 이걸로 하면 될까요??ㅎㅎ
나연가온아빠
8년 전
-.-;;; 머리가;; 아....프....

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인