티스토리 뷰
반응형
Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.
Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.
아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

Turning a string into a Uri in Android
Android에서 문자열을 URI로 변환
문제 내용
I have a string, 'songchoice'
. I want it to become a 'Uri' so I can use with MediaPlayer.create(context, Uri)
저는 문자열 'songchoice'가 있습니다. MediaPlayer.create(context, Uri) 와 함께 사용할 수 있도록 'Uri'가 되길 원합니다.
How can I convert songchoice to the Uri?
songchoice를 Uri로 어떻게 변환할 수 있을까요?
높은 점수를 받은 Solution
Uri myUri = Uri.parse("http://www.google.com");
Here's the doc http://developer.android.com/reference/android/net/Uri.html#parse%28java.lang.String%29
여기 문서가 있습니다. http://developer.android.com/reference/android/net/Uri.html#parse%28java.lang.String%29
가장 최근 달린 Solution
Uri.parse(STRING);
See doc:
문서 참조:
String: an RFC 2396-compliant, encoded URI
문자열: RFC 2396 호환 인코딩 URI
Url must be canonicalized before using, like this:
URL은 다음과 같이 사용하기 전에 정규화되어야 합니다.
Uri.parse(Uri.decode(STRING));
출처 : https://stackoverflow.com/questions/2709087/turning-a-string-into-a-uri-in-android
반응형
'개발 > 안드로이드' 카테고리의 다른 글
'java.lang.IllegalStateException: Not allowed to start service Intent' 오류 수정하기 (0) | 2022.12.19 |
---|---|
안드로이드 웹뷰의 캐시 완전히 지우기 (0) | 2022.12.19 |
버튼 클릭 시 새로운 액티비티 시작하기 (0) | 2022.12.18 |
컨텍스트로 레이아웃 인플레이터 가져오기 (0) | 2022.12.18 |
웹뷰로 외부 웹 페이지 로드하기 (0) | 2022.12.18 |
댓글
공지사항
최근에 올라온 글