'Development'에 해당되는 글 57건

  1. 안드로이드 개발 - 진저브레드(2.3) 이하 버전에서 리스트뷰 스크롤시 하얗거나 검게 변하는 문제 해결
  2. 맥에서 어플 싸인할 시 Eclipse이(가) 예기치 않게 종료되었습니다. 해결방법 1
  3. 안드로이드 EditText에 특정(주소,이메일,숫자 등)의 타입 입력받기
  4. 안드로이드 string.xml 문자열 자바에서 쓰기 1
  5. 안드로이드 intent 값 넘기기
  6. 안드로이드 intent 코드
  7. Sherlock Library에서 사용할수있는 코드
안드로이드 진저브레드(2.3)의 상위 버전인 아이스크림 샌드위치나 젤리빈에서는 이런 현상이 없는데 유독 진저브레드 이하 버전에서는 리스트를 스크롤할 시에 배경이 보이지 않고 하얗거나 검게 변하는 현상이 있습니다.

이런 현상이 있는 이유는 스크롤 속도 최적화를 위해 있는 것인데, 오히려 스크롤이 부자연스러울 뿐더러 보기도 싫습니다.


안드로이드 개발 - 진저브레드(2.3) 이하 버전에서 리스트뷰 스크롤시 하얗거나 검게 변하는 문제 해결

1. 리스트뷰가 정의되어있는 레이아웃에 아래 구분을 추가해줍니다.


   android:cacheColorHint="#00000000" 

예시)
 
<ListView 

    android:id="@android:id/list"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:cacheColorHint="#00000000" 

    android:paddingLeft="@dimen/list_padding"

    android:paddingRight="@dimen/list_padding" />



2. 이 구문은 스크롤 캐시를 투명하게 함으로써 뒤 배경이 보이게 하는 것이므로, 이젠 진저브레드 이하의 운영체제에서도 잘 나오는 것을 확인할 수 있습니다.




도움이 되었나요?
그럼 손가락을 눌러주세요:) 
이클립스는 자바 기반 앱이나 프로그램을 짤때 도움을 주는 도구입니다.
저같은 경우에는 안드로이드 개발을 주로 하는데요.  개발이 끝나고 싸인을 할때, 오류가 나서 적잖히 당황했었습니다.
 



오류 내용

Process:         eclipse [451]
Path:            /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
Identifier:      org.eclipse.eclipse
Version:         3.8 (3.8)
Code Type:       X86-64 (Native)
Parent Process:  launchd [259]
User ID:         501

Date/Time:       2013-01-04 09:22:39.887 +0900
OS Version:      Mac OS X 10.8.2 (12C60)
Report Version:  10

Interval Since Last Report:          15972 sec
Crashes Since Last Report:           3
Per-App Interval Since Last Report:  14480 sec
Per-App Crashes Since Last Report:   3
Anonymous UUID:                      39046084-6511-E487-E6D6-747FB273A8D0

Crashed Thread:  72  Java: ModalContext

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: 0x000000000000000a, 0x000000011163d170

VM Regions Near 0x11163d170:
    CG image               000000011162e000-000000011163b000 [   52K] rw-/rwx SM=COW  
--> mapped file            000000011163b000-0000000111642000 [   28K] r--/r-x SM=PRV  /Volumes/VOLUME/*/*.jar
    VM_ALLOCATE            0000000111642000-0000000111643000 [    4K] rw-/rwx SM=COW  

Application Specific Information:
Java information:
 Exception type: Bus Error (0xa) at pc=1007d06f7
 
 Java VM: Java HotSpot(TM) 64-Bit Server VM (20.12-b01-434 mixed mode macosx-amd64)
... 



해결방법
열심히 구글링을 통해 해결방법을 찾았습니다.

1. 이클립스에 상단부분 메뉴에 Project를 눌러줍니다.

 
 
2. "Build Automatically"를 체크 해제합니다.


 이렇게 하시면 오류는 나지 않으나 빌드는 자동으로 되지 않습니다.
솔직히 빌드는 자동으로할 필요가 없습니다. Run Application하면 빌드가 되니까요.





이 포스팅이 해결하는데 도움이 되었으면
손가락을 눌러주세요 :) 
안드로이드 레이아웃은 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를 넣으면 됩니다.


 
이글이 도움이 되었다면 손가락을 눌러주세요. :) 

getString(R.string.문자열)


손가락은 장식용이 아닙니다:) 

넘기는 쪽
 //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();


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

  Intent intent = new Intent(MainActivity.this, list.class); // 두번째 액티비티를 실행하기 위한 인텐트

startActivity(intent); 

package 패키지명;
//ActionBarSherlock를 사용하기 위해 임포트해줘야 하는 것들
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.MenuInflater;
//(..기타 임포트 생략)
 
public class MainActivity extends SherlockActivity {
//기본 Activity 대신 SherlockActivity를 상속받습니다.
 
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_layout);
    }
 
@Override
    public boolean onCreateOptionsMenu(Menu menu) {
    //메뉴 버튼 구현부분
    MenuInflater inflater = getSupportMenuInflater();
        inflater.inflate(R.menu.main_layout, menu);
        return true;
 
    }
 
}