안드로이드/기타

Intent Share (공유하기)

FA1976 2017. 1. 19. 09:24
반응형


앱들을 보면 공유하기 기능이 있다. 요걸 하는 간단한 방법은 아래 코드를 삽입하면 된다.


Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);


sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");

요 코드에 주소를 쓰던지. 예제처럼 글을쓰던지해서 카톡이나 메일 SNS 등등으로 보내기를 할수 있다.


자세한 설명은 아래 사이트 참조


https://developer.android.com/training/sharing/send.html

반응형