PC에서 BOOK마크저장과 같이 모바일에서 클릭으로 핸드폰번호를 연락처에 저장할수있을까요?
본문
내용 그대로 입니다~~!
PC에선 북마크버튼을 누르면 북마크에 저장되잖아요~
근데 모바일 화면에서 버튼을 누르면 휴대폰 번호가 상대방의 연락처에 저장되게 할 방법이
있을까요?
답변 2
연락처 <a href="tel:전화번호">전화번호나 버튼이미지</a>
위처럼 http://대신에 tel:해놓으시면 휴대폰에서 전화번호를 누르면 통화를 할건지 저장을 할건지 뜹니다.
sms:하시면 문자전송이 될겁니다. 이건 제가 써보질 않아서요.
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
답변을 작성하시기 전에 로그인 해주세요.