본문 바로가기

전체 글310

42] Leetcode 1528. Shuffle String https://leetcode.com/problems/shuffle-string/ Shuffle String - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ans와 s는 길이가 같을 테니 초기값을 s로 하고 하나씩 바꾼다. class Solution { public: string restoreString(string s, vector& indices) { string ans = s; for(int i = 0;i 2020. 8. 18.
41] Leetcode 1. Two Sum https://leetcode.com/problems/two-sum/ Two Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { public: vector twoSum(vector& nums, int target) { vectorans; for(int i = 0;i 2020. 8. 18.
Kotlin] 안드로이드 스튜디오 AsyncTask ProgressDialog inner class ReadTask : AsyncTask() { val asyncDialog : ProgressDialog = ProgressDialog(this@MainActivity) override fun onPreExecute() { ....... asyncDialog.setProgressStyle(ProgressDialog.BUTTON_POSITIVE) asyncDialog.setMessage("지도 초기화 중...") asyncDialog.show() } .... override fun onPostExecute(result: String?) { // 종료 asyncDialog.dismiss() } } Use ProgressBar instead.. #참고 https://android--exam.. 2020. 8. 17.
Kotlin] 안드로이드 스튜디오 // 좌표로 거리구하기 myLoc에서 targetLoc까지의 거리를 구한다. 반환값은 float로 단위는 m이다. // 좌표로 거리구하기 fun getDistance( lat1: Double, lng1:Double, lat2:Double, lng2:Double) : Float{ val myLoc = Location(LocationManager.NETWORK_PROVIDER) val targetLoc = Location(LocationManager.NETWORK_PROVIDER) myLoc.latitude= lat1 myLoc.longitude = lng1 targetLoc.latitude= lat2 targetLoc.longitude = lng2 return myLoc.distanceTo(targetLoc) } https://.. 2020. 8. 13.
Kotlin] 안드로이드 스튜디오 인터넷 연결 상태 확인 // 인터넷 연결 확인 fun checkInternetConnection() : Boolean { val cm = getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager val activeNetwork: NetworkInfo? = cm.activeNetworkInfo if (activeNetwork != null) return true return false } 연결 상태 확인 및 모니터링 | Android 개발자 | Android Developers 반복적인 알람과 백그라운드 서비스를 사용하는 가장 일반적인 방법은 인터넷 리소스의 애플리케이션 데이터 정기 업데이트를 예약하거나, 데이터를 캐싱하거나, 오래 진행되는 다운로드를 실 developer.a.. 2020. 8. 8.
안드로이드 스튜디오] 애뮬레이터 인터넷 연결 끄기 https://stackoverflow.com/questions/8499812/how-do-i-disable-the-internet-connection-in-android-emulator#:~:text=You%20can%20disable%20the%20Internet,it%20will%20dis%2Dconnect%20it. How do I disable the Internet connection in Android Emulator? I am trying to check Internet connectivity on Android using the following method. I have a Wi-Fi connection. private boolean checkInternetConnection() { C.. 2020. 8. 8.