티스토리 뷰
반응형
Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.
Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.
아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.
Sending an Intent to browser to open specific URL
브라우저에 특정 URL 열기 인텐트 보내기
문제 내용
I'm just wondering how to fire up an Intent to the phone's browser to open an specific URL and display it.
나는 특정 URL을 열고 표시하기 위해 전화기의 브라우저에 인텐트를 어떻게 보내야하는지 궁금하다.
Can someone please give me a hint?
누가 저에게 힌트를 주실 수 있나요?
높은 점수를 받은 Solution
To open a URL/website you do the following:
URL/웹 사이트를 열려면 다음을 수행합니다.
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
Here's the documentation of Intent.ACTION_VIEW
.
여기 의도에 대한 문서가 있습니다.ACTION_VIEW.
Source: Opening a URL in Android's web browser from within application
출처: 애플리케이션 내에서 Android의 웹 브라우저에서 URL 열기
가장 최근 달린 Solution
Sending an Intent to Browser to open specific URL:
브라우저에 특정 URL 열기 의도 보내기:
String url = "https://www.stackoverflow.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
could be changed to a short code version ...
짧은 코드 버전으로 변경될 수 있습니다...
Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://www.stackoverflow.com"));
startActivity(intent);
or
또는
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.stackoverflow.com"));
startActivity(intent);
or even more short!
아니면 더 짧게!
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.stackoverflow.com")));
More info about Intent
인텐트에 대한 추가 정보
=)
출처 : https://stackoverflow.com/questions/3004515/sending-an-intent-to-browser-to-open-specific-url
반응형
'개발 > 안드로이드' 카테고리의 다른 글
액티비티 상태 저장하기 (0) | 2022.12.01 |
---|---|
Fragment에서 Context 사용하기 (0) | 2022.11.30 |
Android WebView & 로컬 스토리지 (0) | 2022.11.30 |
Eclipse로 프로젝트를 가져온 후 'Must Override a Superclass Method'' 오류 (0) | 2022.11.30 |
android.os.FileUriExposedException 수정하는 방법 (0) | 2022.11.30 |
댓글
공지사항
최근에 올라온 글