본문 바로가기

전체 글1748

안드로이드 뒤로가기 버튼 더블클릭해서 앱 종료하기 앱 사용하다가 종료를 할때 뒤로가기 버튼을 한번 더 터치하면 앱을 종료한다는거 한번 이상은 보셨을거라 생각을 합니다. 코드를 보도록 하겠습니다. BackPressCloseHandler.java public class BackPressCloseHandler extends Activity { private long backKeyPressedTime = 0; private Toast toast; private Activity activity; public BackPressCloseHandler(MainActivity context) { this.activity = context; } public void onBackPressed() { if (System.currentTimeMillis() > backKeyP.. 2016. 8. 21.
안드로이드 구글 애드몹 전면광고 넣기 package com.example; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.InterstitialAd; import android.app.Activity; import android.widget.Toast; public class BackPressCloseHandler { private long backKeyPressedTime = 0; private Toast toast; private Activity activity; private InterstitialAd interstitial; public BackPressCloseHa.. 2016. 8. 21.
인텐트(Intent)로 데이터 전달(putExtra, getExtras) 인텐트(Intent)를 사용할 때 데이터를 전달하는 방법에 대해서 이야기 하겠다. Intent로 다른 Activity(예, AnotherActivity.class)를 실행시킬 때는 다음과 같이 한다. Intent intent = new Intent(getApplicationContext(), AnotherActivity.class); startActivity(intent); 그런데, 여기에 추가로 AnotherActivity 데이터를 전달하고 싶을 때가 있다. 이때 사용할 수 있는 것이 putExtra() 다. Intent intent = new Intent(getApplicationContext(), AnotherActivity.class); intent.putExtra("name", "rio"); i.. 2016. 8. 21.
SharedPreferences란? SharedPreferences란? - DB를 사용하기에는 좀 그런 경우에 SharedPreferences를 사용하면 적합하다. - 보통 초기 설정값이나 자동로그인 여부 등 간단한 값을 저장하기 위해 사용한다. - 어플리케이션에 파일 형태로 데이터를 저장한다. - 어플리케이션이 삭제되기 전까지 보존된다. 사용법 import android.content.SharedPreferences; 1. SharedPreferences인스턴스 얻기 getPreferences(int mode) 하나의 액티비티에서만 사용하는 SharedPreferences를 생성한다. 생성되는 SharedPreferences 파일은 해당 액티비티이름으로 생선된다. 하나의 액티비티에서만 사용할 수 있지만 getSharedPreference.. 2016. 8. 21.
[Android Intent Useage] 안드로이드 Intent 사용 방법 //show webapp: Uri uri = Uri.parse("http://www.google.com"); Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it); //show maps: Uri uri = Uri.parse("geo:38.899533,-77.036476"); Intent it = new Intent(Intent.Action_VIEW,uri); startActivity(it); //show ways Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en"); Intent it = new Int.. 2016. 8. 21.
Android Intent - 안드로이드 인텐트 ■ Intent - 인텐트 인텐트는 안드로이드 OS 상에서 서로 다른 객체들 간에 자료를 전달하거나 호출해 실행하는 단위 입니다. Intent는 애플리케이션 내부와 애플리케이션 간의 메시지를 전달 할 때 사용되는 클래스 입니다. 안드로이드 기기 내의 모든 애플리케이션 컴포넌트 간의 상호작용을 할 수 있습니다. (쉽게 말하자면 인텐트를 통해 해당 애플리케이션에서 다른 애플리케이션을 실행시킨다던가, 데이터들을 주고 받을 수 있습니다.) 인텐트는 명시적 인텐트(Explicit Intent)와 암시적 인텐트(Implicit Intent) 두 가지로 나눌 수 있습니다. ■ Explicit Intent - 명시적 인텐트 명시적 인텐트는 호출하거나 메시지를 보낼 대상 컴포넌트 이름을 지정하는 방식 입니다. 주로 애플.. 2016. 8. 21.
Mediaplayer 로 지정되어있는 벨소리 재생하기 안드로이드에서 알림음을 실행하려는데 기왕이면 벨소리로 지정되어 있는것이 나을거 같아서 찾아보면서 했던 삽질들을 정리 가장 햇갈렸던 Stream 방식. - 출력방식을 설정하는 것으로써, 외장스피커와 내장스피커를 선택할 수 있다. 현재 지정되있는 벨소리 URI 를 가져오는 방법 - 현재 있는 설정되어 벨소리나 알람의 파일위치를 가져오는 방법 (만약 파일을 첨부하고 해당 파일을 재생하고 싶다면 아래 예를 참조) 현재 설정된 벨소리를 미디어로 재생시키고 싶은 경우 MediaPlayer mPlayer = new MediaPlayer(); // 객체생성 // TYPE_RINGTONE 을 하면 현재 설정되어 있는 밸소리를 가져온다. // 만약 알람음을 가져오고 싶다면 TYPE_ALARM 을 이용하면 된다 Uri al.. 2016. 8. 21.
jQuery Mobile에서 유용한 코드 10가지. 1. 리스트 아이템이나 버튼에서 텍스트가 잘리지 않게 하기. 리스트 아이템이나 버튼의 텍스트가 길 경우에는 jQuery Mobile에 의해 자동으로 잘리게 된다. 이를 방지하기 위해서는 "white-space:normal;"을 CSS에 추가하면 된다. 버튼을 위한 예제는 아래와 같다. .ui-btn-text { white-space: normal; } 리스트를 위한 예제는 아래와 같다. .ui-li-desc { white-space: normal; } 다시 원래 설정으로 되돌리기 원할경우에는, "white-space:nowrap;"으로 설정하면 된다. 2. 페이지 로드시에 배경이미지를 랜덤하게 보여주기. jQuery Mobile은 페이지 로드시에 다양한 초기화 방식을 가지고 있다. 아래의 CSS + Ja.. 2016. 8. 17.
SHOUTcast Stream Ripper Separate metadata from the SHOUTcast stream to automatically name and split the MP3 data and save to disk. Introduction This article is an extension of the article from Dani Forward. It implements the SHOUTcast protocol to get the metadata header from the SHOUTcast streams and read out the song titles. With this information, it is possible to automatically split the songs, store them as MP3 file.. 2016. 2. 15.
SHOUTcast/Installation Setting up SHOUTcast Server Installing the files The SHOUTcast Server can be found in media-sound/SHOUTcast-server-bin. You can install it with the following command: root #emerge --ask shoutcast-server-bin The SHOUTcast Server will now be installed. The next step is configuring your new SHOUTcast Server. Configuring SHOUTcast Server Now that SHOUTcast Server is installed, it must be configured... 2016. 2. 15.
PhP script to parse Shoutcast metadata? If you want to use PHP , you need to make a PHP file with this contents : the $xml have some Objects that they have Meta information , and you can Easily Print them , i will show you an Example : this one can Print Artist Name . if you need to know Objects name , go to : yourdomain:yourport/admin.cgi?mode=viewxml&pass=youradminpass&page=5&sid=1 * You need to run PHP script on the Server that you.. 2016. 2. 9.
SHOUTCast AutoDJ acho que esse script deve ajudar com status: 2016. 2. 9.
PHP cURL to kick Shoutcast Source The code I have so far is like this 2016. 2. 9.
검색엔진 최적화. 꼭 알아야 할 HTTP 상태 코드 HTTP 상태 코드란 클라이언트에서 온 요청(request)의 성공 여부를 코드로 표기한 것입니다. 예를 들어 브라우저에서 artience.co.kr을 입력합니다. (클라이언트에서 artience.co.kr을 요청한거죠). 이때 브라우저에 아티언스 메인 페이지가 뿅~ 나타나면 이는 클라이언트 요청(request)이 성공한 것입니다. 하지만 나오라는 아티언스 메인 페이지는 안나오고 백지 화면에 “404 NOT FOUND”라는 메세지만 보인다면 클라이언트의 요청이 실패한 것입니다. 이렇게 클라이언트의 요청이 실패 했을때, 왜! 어떠한 이유로! 실패했는지 알수 있게 해 주는 것이 바로 HTTP 상태코드 입니다. 검색엔진은 HTTP 상태 코드를 읽기 때문에 정확한 HTTP 상태 코드를 사용해야지만 검색엔진의 혼.. 2016. 2. 7.
PHP 배열 함수 정리 function pre($val){ echo ''; print_r($val); echo ''; } /* 배열생성 array array = array(mixed) http://php.net/manual/en/function.array.php */ $arr = array(1,2,3,4,5,6); pre($arr); $arr = array('a'=>'apple','b'=>'banana','c'=>'cherry'); pre($arr); $arr = array('one',5=>'two','three'); pre($arr); $arr = array(1,3,2=>8,4,0=>6); pre($arr); $arr = array('a'=>'apple','b'=>'banana','c'=>'cherry','d'=>array(.. 2016. 2. 3.
반응형

Copyright ⓒ SmartWeb All rights reserved.