'android'에 해당되는 글 28건

  1. 안드로이드폰 카메라 무음 설정하기 24
  2. Android 이클립스 아무 이유없이 오류가 나는 경우 - 최소한의 오류만 나게 하기(Android Lint/Clean) 4
  3. AndroidManifest.xml에 같은 Activity정의가 중복되는 경우
  4. Android GridView 키보드가 있을 시 아이템을 가려 스크롤이 안되는 문제 해결(키보드가 나타날때 리사이즈)
  5. Android Shared Preferences(데이터 저장/불러오기) 활용하기
  6. 안드로이드 EditText에 특정(주소,이메일,숫자 등)의 타입 입력받기
  7. 안드로이드 intent 값 넘기기
  8. BlueStacks Alpha- 윈도우(Windows) 에서 안드로이드 앱(Android) 사용하기 2
요즘에 휴대폰에는 다 기본적으로 카메라가 내장되어 있으며 현재 인기가 많은 스마트폰도 예외가 아닐 수 없습니다. 
대한민국 법에 따라 모든 스마트폰에는 강제적으로 스마트폰 카메라 셔터음이 나도록 설정이 되어있는데요.
몰카나, 초상권 침해같은걸 막기에는 아주 좋은 정책이나, 소리가 나면 안되는 상황이나 실험시에는 아주 불편합니다.

 
Build.prop을 건드려서 안드로이드 스마트폰 카메라 무음 만들기

거의 모든 안드로이드 스마트폰이 이 방법으로 카메라 무음으로 되는 보편적인 방식입니다.
기본적으로 스마트폰 루팅이 되어있어야 합니다.

주의!!! 루팅을 통한 모든 시스템 변경 활동은 예상치 못한 오류(벽돌)을 감수하실 수 있어야 합니다.

밸소리 모드로 해놓으면 셔터음이 나나 무음모드로 해놓으면 나지 않습니다.(원래는 무음모드도 납니다.)


1. Root Explorer같은 루트 탐색기 어플로 /System 폴더에 들어가 마운트 R/W를 눌러 R/W로 마운트해주시기 바랍니다.


 2. Build.prop 파일을 찾아 길게 터치해서 "택스트 편집기로 파일 열기"를 터치해줍니다. 


3. "ro.camera.sound.forced=1" 부분을 찾아서 값 1을 0으로 변경해줍니다.

 

 4. 메뉴 변경 사항 저장을 눌러 저장해주신후 재부팅합니다.


이렇게 하시면 무음 모드일시에 카메라 셔터음이 나지 않습니다.
이런 방법으로 몰카와 유사한 범죄를 할시 책임지지 않습니다.

이 방법으로 완전한 무음이 되지 않는 경우

안드로이드폰 카메라 무음 설정하기 - 초점 소리까지 완전하게 없애기(무음이 완전히 되지 않는 경우)(http://jhrun.tistory.com/114)



도움이 되셨나요?
손가락을 눌러주세요! 
오류가 날 이유가 없는데도 오류를 뿜으면서 빌드가 안되는 경우가 있습니다. 이런 빨간색 X표시는 개발자의 수명을 10년치씩 줄어들게 해줍니다.




꼭 고쳐야 할 필요 없는 애러까지도 나게 하는 것은 머리가 아픕니다.
꼭 빌드가 되지 않는 이유가 있는 경우에만 애러가 나게 할 수 있습니다.

최소한의 애러만 나게 하기(Android Lint 변경/Project Clean)
 
1. 아무 패키지에서나 오른쪽 클릭 한 뒤에 Properties 를 눌러 줍니다.



2. Android Lint Preferences 탭에서 Ignore All을 눌러준후 OK를 눌러줍니다.

 
3. Yes를 눌러 모든 프로젝트 상태를 업데이트 해줍니다.

 

 4. Project --> Clean을 눌러준 후 Clean All Projects나 자신의 프로젝트를 체크후 OK눌러줍니다.



이러면 이클립스의 결함이나 꼬임 등으로 인한 문제는 모두 해결되는 것을 확인하실 수 있습니다.


 
도움이 되셨나요?
거침없이 손가락을 눌러주세요. 

  <activity

            android:name=".listt"

            android:windowSoftInputMode="stateAlwaysHidden" />


안드로이드에서는 위와같이 액티비티를 AndroidManifest.xml에 정의해줘야 합니다.

 
android:windowSoftInputMode="stateAlwaysHidden" 이런식으로 자신이 원하는 속성을 각 액티비티에 정의해줄 수 있는데요.

  android:windowSoftInputMode="stateAlwaysHidden"
 android:windowSoftInputMode="adjustResize" 

 때로는 위와 같이 2개 이상의 속성을 정의해주어야 할 때가 있습니다. 그런데 android:windowSoftInputMode가 중복되어있어 컴파일시에 애러가 납니다.
저 2개의 속성이 필요한데 중복되서 애러가 납니다.

해결방법
 
2개의 속성을 지정하고 싶은데 중복되는 경우에는 아래와 같이  "|" 를 사이에 두 하시면 됩니다. 아래 내용처럼요.

  android:windowSoftInputMode="adjustResize|stateAlwaysHidden"


이와 같이 하면 같은 항목의 속성을 2개 이상으로 할 수 있습니다.
(참고) 위에 나온 저 코드는 edittext에 자동으로 포커스는 주지 말면서 키보드가 올라올시 앱의 크기를 리사이즈 하라는 코드입니다.


 손가락은 장식용이 아닙니다. 
안드로이드 레이아웃중 하나인 GridView를 사용할때가 참 많습니다. ListView보다 자세한 정보는 아니지만 한번에 많은 양의 정보나 아이콘을 보여줄때 주로 쓰입니다.
저같은 경우에는 검색 앱인 FastEngine 에서 주로 사용됩니다.

그런데 GridView에서 많은 양의 아이템이 있을 시에 키보드 아래의 아이콘은 스크롤이 안되는 문제가 발생하였습니다.
ListView에서는 잘되는데 GridView에서만 되지 않았습니다.

(키보드 아래에 있는 아이콘이 스크롤이 안되 보이지 않습니다.)

해결 방법(키보드가 나타날때 앱 크기 리사이즈)
 
해결방법은 간단했습니다. 열심히 구글링해서 찾아낸 결과 AndroidManifest.xml에 자신의 액티비티 정의 항목에서
아래 코드를 삽입해주시면 됩니다.

android:windowSoftInputMode="adjustResize"


이 코드는 키보드가 나타날때 앱 크기를 리사이즈해주는 코드로써 화면에 키보드를 제외한 공간을 앱의 공간으로 쓰이게 합니다.

따라서 이제 키보드가 있는 상태에서도 끝까지 스크롤이 가능하게 되었습니다.



조금이라도 도움이 되었습니까?
도움이 되셨으면 손가락을 눌러주세요 :) 

데이타를 일시적으로는 가지고 있을 수 있지만 영원히 저장하는 방법은 무었일까요? Shared Preferences 를 사용하면 가능합니다.
이 방법을 이용해서 환경설정을 만들 수도 있습니다.
           

설정 저장

            //값보관
             SharedPreferences pref =getSharedPreferences("test", MODE_PRIVATE);
             SharedPreferences.Editor editor = pref.edit();
             editor.putString("SET_1","1" ); //키값, 저장값
             editor.putString("SET_2","2" );
             editor.putString("SET_3","3" );
             editor.commit();
     
설정 불러오기
 

              //값읽기
              SharedPreferences prefs =getSharedPreferences("test", MODE_PRIVATE);
              String result = prefs.getString("SET_1", "0"); //키값, 디폴트값
                
                
              //키값없이 모든 저장값 가져오기
             SharedPreferences prefb =getSharedPreferences("test", MODE_PRIVATE);
             Collection<?> col =  prefb.getAll().values();
             Iterator<?> it = col.iterator();
                
              while(it.hasNext())
              {
                    String msg = (String)it.next();
                    Log.d("Result", msg);
              }





손가락을 누르는것보다 어려운게 있나요 :)
도움이 되셨으면 눌러주세요  :)



안드로이드 레이아웃은 xml로 작성합니다. UI를 xml로 구성하는 것입니다. 자신이 EditText에 입력받고 싶은 특정 값이 있을 겁니다. 그 값이 숫자이면 숫자만 있는 키보드를 호출해야 하고, 이메일이면 키보드에 @를 쉽게 칠 수 있게 하는게 사소한 배려겠죠.


EditText 속성


자신이 입력받고 싶은 것을 쉽게 입력할수 있게 EditText에 속성을 넣어줄 수 있습니다. 

    <EditText

        android:id="@+id/editText1"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_alignLeft="@+id/textView1"

        android:layout_below="@+id/textView1"

        android:layout_marginTop="40dp"

        android:ems="10" >

 
 소스는 대충 위처럼 생겼을 것입니다. 필요에 따라서 저 줄이 늘어나기도 아니면 줄어들기도 하죠. 자신이 원하는 editText에다. 아래 코드를 추가해보세요.

      android:inputType="자신이 원하는 타입" 

android:inputType= 은 입력할 타입을 지정하는 것입니다. 위 코드 자신이 원하는 타입이라는 문자를 지우고 자신이 원하는 타입을 아래 설명을 참고하여 넣으시면 되겠습니다.

android:inputType

The type of data being placed in a text field, used to help an input method decide how to let the user enter text. The constants here correspond to those defined by InputType. Generally you can select a single value, though some can be combined together as indicated. Setting this attribute to anything besides none also implies that the text is editable.

Must be one or more (separated by '|') of the following constant values.

ConstantValueDescription
none 0x00000000 There is no content type. The text is not editable.
text 0x00000001 Just plain old text. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_NORMAL.
textCapCharacters 0x00001001 Can be combined with text and its variations to request capitalization of all characters. Corresponds to TYPE_TEXT_FLAG_CAP_CHARACTERS.
textCapWords 0x00002001 Can be combined with text and its variations to request capitalization of the first character of every word. Corresponds to TYPE_TEXT_FLAG_CAP_WORDS.
textCapSentences 0x00004001 Can be combined with text and its variations to request capitalization of the first character of every sentence. Corresponds to TYPE_TEXT_FLAG_CAP_SENTENCES.
textAutoCorrect 0x00008001 Can be combined with text and its variations to request auto-correction of text being input. Corresponds to TYPE_TEXT_FLAG_AUTO_CORRECT.
textAutoComplete 0x00010001 Can be combined with text and its variations to specify that this field will be doing its own auto-completion and talking with the input method appropriately. Corresponds toTYPE_TEXT_FLAG_AUTO_COMPLETE.
textMultiLine 0x00020001 Can be combined with text and its variations to allow multiple lines of text in the field. If this flag is not set, the text field will be constrained to a single line. Corresponds toTYPE_TEXT_FLAG_MULTI_LINE.
textImeMultiLine 0x00040001 Can be combined with text and its variations to indicate that though the regular text view should not be multiple lines, the IME should provide multiple lines if it can. Corresponds to TYPE_TEXT_FLAG_IME_MULTI_LINE.
textNoSuggestions 0x00080001 Can be combined with text and its variations to indicate that the IME should not show any dictionary-based word suggestions. Corresponds toTYPE_TEXT_FLAG_NO_SUGGESTIONS.
textUri 0x00000011 Text that will be used as a URI. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_URI.
textEmailAddress 0x00000021 Text that will be used as an e-mail address. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_EMAIL_ADDRESS.
textEmailSubject 0x00000031 Text that is being supplied as the subject of an e-mail. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_SUBJECT.
textShortMessage 0x00000041 Text that is the content of a short message. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_SHORT_MESSAGE.
textLongMessage 0x00000051 Text that is the content of a long message. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_LONG_MESSAGE.
textPersonName 0x00000061 Text that is the name of a person. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_PERSON_NAME.
textPostalAddress 0x00000071 Text that is being supplied as a postal mailing address. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_POSTAL_ADDRESS.
textPassword 0x00000081 Text that is a password. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_PASSWORD.
textVisiblePassword 0x00000091 Text that is a password that should be visible. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_VISIBLE_PASSWORD.
textWebEditText 0x000000a1 Text that is being supplied as text in a web form. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_WEB_EDIT_TEXT.
textFilter 0x000000b1 Text that is filtering some other data. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_FILTER.
textPhonetic 0x000000c1 Text that is for phonetic pronunciation, such as a phonetic name field in a contact entry. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PHONETIC.
textWebEmailAddress 0x000000d1 Text that will be used as an e-mail address on a web form. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS.
textWebPassword 0x000000e1 Text that will be used as a password on a web form. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_PASSWORD.
number 0x00000002 A numeric only field. Corresponds to TYPE_CLASS_NUMBER |TYPE_NUMBER_VARIATION_NORMAL.
numberSigned 0x00001002 Can be combined with number and its other options to allow a signed number. Corresponds to TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_SIGNED.
numberDecimal 0x00002002 Can be combined with number and its other options to allow a decimal (fractional) number. Corresponds to TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_DECIMAL.
numberPassword 0x00000012 A numeric password field. Corresponds to TYPE_CLASS_NUMBER |TYPE_NUMBER_VARIATION_PASSWORD.
phone 0x00000003 For entering a phone number. Corresponds to TYPE_CLASS_PHONE.
datetime 0x00000004 For entering a date and time. Corresponds to TYPE_CLASS_DATETIME |TYPE_DATETIME_VARIATION_NORMAL.
date 0x00000014 For entering a date. Corresponds to TYPE_CLASS_DATETIME |TYPE_DATETIME_VARIATION_DATE.
time 0x00000024 For entering a time. Corresponds to TYPE_CLASS_DATETIME |TYPE_DATETIME_VARIATION_TIME.

This corresponds to the global attribute resource symbol inputType.

Related Methods
 예를 들면 자신은 숫자 문자열을 원한다. 하면 number를 넣으면 됩니다.


 
이글이 도움이 되었다면 손가락을 눌러주세요. :) 
넘기는 쪽
 //1. Activity 를 부르기 위해서 인텐트 객체를 생성. - intent 객체에 실행할 액티비티 클래스 명을 명시
    Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
    
    //2. 인텐트에 액티비티 정보, 전달할 데이터 저장.
    intent.putExtra("data", "첫번째 액티비티에서 공유한 데이타");
    
    startActivity(intent); 
// 인텐트 실행

받는 쪽
 
  Intent intent = getIntent();//인텐트  받아오고
  String msg = intent.getStringExtra("data");//인텐트로 부터 데이터 가져오고
  Toast t = Toast.makeText(this, msg, Toast.LENGTH_LONG);//값 사용 예시 ex.토스트
  t.show();


손가락은 누르라고 만든 것입니다:)

BlueStacks란?


주로 안드로이드(Android) 스마트폰에서만 작동되는 앱들을 PC에서 작동시켜줍니다.
가상 예뮬레이터(SDK,Vmware)이나 컴퓨터 하드디스크에다 안드로이드를 설치해서 작동시킬 수도 있지만, 오랫동안 기다려야 하고 PC,Android 모드 전환 작업이 쉽지 않았기 때문에

BlueStacks는 빠른 시간내에 안드로이드 앱을 실행시켜준다는 장점이 있습니다.

다운로드/설치

 다운로드는 아래 파일 링크를 클릭하시면 다운로드 하실 수 있습니다.

참고!! : 이 프로그램은 윈도우7(Windows7) 이상의 버전에서만 작동됩니다.
참고!! : 이 버전은 알파 버전입니다.


다운완료 하셨으면 파일을 열어 설치해 주시면 됩니다. 설치는 별로 어렵지 않으니 생략하겠습니다.

설치 후 세팅

 설치가 완료되었으면 바탕화면에 BlueStacks 아이콘을 보이면 정상적으로 설치된 것입니다.


이제는 세팅을 해주는 일만 남았습니다.

Launcher+Pro+Plus+v0.8.6_kor.apk 


위 2개의 어플 파일 링크를 클릭해 다운받아주신 다음에 Launcher Pro Plus 0.8.6 kor.apk 에다가 오른쪽 마우스 클릭 후 연결 프로그램 -  기본 프로그램 선택

 


찾아보기 누른 후에 C:\Program Files(x86)\Bluestacks 폴더로 이동(Program Files(x86) 폴더가 없는 경우에는 Program Files) / HD-ApkHandler.exe 더블클릭 하시면 앱이 자동으로 설치됩니다.

바탕화면의 BlueStacks App player 클릭후 아래처럼 생긴 버튼 후 방금 자신이 설치한 어플이 있는 지 확인 후 실행하시면 됩니다.





 
이런 과정을 거치셨으면 다음부터 APK 파일 설치하실 때 그냥 더블클릭만 하시면 됩니다.

한국어 설정

BlueStacks는 한국에서 만든 프로그램이 아니기 때문에 기본 설정은 영어입니다.
한국에서 사용하기 그나마 쉽도록 세팅하는 방법입니다.


언어 변경

1. BlueStacks App player를 실행한 후 Launcher Pro를 실행합니다.

2. 메뉴 버튼(ㅡ가 네줄)을 누르고 Settings 버튼을 누릅니다.

3. Language & keybored 를 누른후에 Select language 버튼을 눌러줍니다.

4. 화면을 위쪽으로 밀거나 마우스 스크롤을 위로 올린 후 Korean을 찾은 후 클릭합니다.

5. 언어가 변경되었습니다.

키보드 변경

GanadaIMEBeta0.9.0.apk 

1. 위 링크를 클릭해 가나다 키보드를 다운받습니다.

2. 가나다 키보드 apk를 더블 클릭해 앱을 설치합니다.

2.
BlueStacks App player를 실행한 후 Launcher Pro를 실행합니다.

3. 
언어 및 키보드를 누른 후에 아래 사진처럼 중국어로 되어있는 키보드와 Android 키보드 항목을 해제하고 가나다 키보드 항목을 선택하세요.

 



이 정보들이 도움이 됬으면 아래 손가락 쾅!!!