본문 바로가기

개발도구/aOS - 안드로이드 개발

[안드로이드] 버튼 클릭시 스피너 사용하기 - 다이어로그! DialogInterface private void openNewGameDialog() { new AlertDialog.Builder(this) .setItems(R.array.SNS , new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dia, int i) { startGame(i); } }) .show(); } private void startGame(int i){ Log.d("sado", "clicked on"+i); } array.xml 트위터 페이스북 미투데이 카카오톡 더보기
[안드로이드] EXCEPTION: main - Unable to start activity ComponentInfo 대체로 Activity 또는 콤포넌트를 찾지 못하는 경우 발생하게 된다. 확인경로 ) 1. 대게는 Activity를 Manifast 파일에 등록을 시키지 않았을 경우 혹은 오타 2. 만약 안드로이드 콤포넌트를 확장해서 재정의한 경우라면 생성자를 모두 정의하지 않았을 경우에도 발생할 수 있다. 저의 경우는 class 에서 먼저 정의 하고(xml 없는 상태에서 정의하면 에러가 난다.) , 그 후에 xml 파일을 만들어 넣어도 이미 에러난 상태만 유지하고 있어서 반대로 xml 만든후 class에 코딩하니 잘 된다. 3. Activity를 정의한 경우라면 Manifast파일에 제대로 추가했는지 확인 4. 콤포넌트를 확장해 사용한 경우라면 모든 생성자를 오버라이딩 해주었는지 확인 더보기
[안드로이드] Toast 와 Log 를 찍어 보자 Toast 와 Log 는 기본적으로 문자형만 받기 때문에 형변환은 필수 이다. Toast t = Toast.makeText(getApplicationContext()," font size : " + Integer.toString(defaltSize) , Toast.LENGTH_SHORT); // 정의 t.setGravity(Gravity.CENTER, 0, 0); // 정렬 t.show(); // 보여줌 Log.d("111", Integer.toString(defaltSize)); 더보기
[안드로이드] String - >int 형변환 Integer.toString(position+1) 더보기
[안드로이드] textview bold 볼드 만들기 android:layout_width="wrap_content"                        android:layout_height="wrap_content"                         android:gravity="left"                        android:layout_marginLeft="10dip"                        android:layout_weight="100"                        android:textSize="10px"                        android:textStyle="bold" 볼드 만들기                        android:textColor="#00.. 더보기
[안드로이드] xml없이 layout, button, text 설정해보자! LinearLayout layout = new LinearLayout(getApplicationContext());// 리니어 레이아웃(뼈대 1) layout.setOrientation(LinearLayout.VERTICAL); // 리니어 레이아웃 자식붙이기 (뼈대2) LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT); layoutParams.setMargins(0,0,0,0); layoutParams.weight = 1.0f; mGallery.setIsGalleryCircular(fal.. 더보기
[안드로이드] 메뉴 이미지 변경 버튼 위와 같이 탑에 메뉴를 넣기 원한다면, 아래와 같이 사용해 보면 좋을거 같습니다. onCreate() 에 선언 mainTabListenerOn(); // menuMain1 이미지 버튼 5개에 관한 클래스 버튼 이름은 mainMenu1 , 2,3,4... inculde 이름은 Main_menu1,2,3,4.... 간단하게 처리가능합니다. :) ... 버튼 클릭시 이벤트 public void mainTabListenerOn() { findViewById(R.id.mainMenu1).setOnClickListener( new ImageButton.OnClickListener() { public void onClick(View v) { mainContentToggle(v); } }); findViewById(R.. 더보기
[안드로이드] tab line 없애기 tabStripEnabled 탭 밑에 라인을 tabStrip 라고 부른다. TabWidget android:tabStripEnabled="false" 단 sdk 8 부터 적용이 된다. 유의하자! 더보기
[안드로이드] tab 높이 조절 android:layout_width="fill_parent" android:layout_height="70px" android:gravity="center" /> 더보기
[안드로이드] 인트로 화면 구성하기 public class Intro extends Activity { Handler myHandler = new Handler(); Runnable myRunnable = new Runnable() { public void run() { Intent i = new Intent(Intro.this, Host.class); overridePendingTransition(R.anim.fade, R.anim.hold); i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); Intro.this.startActivity(i); finish(); - 백했을경우 닫아 버리기 // overridePendingTransition(0,0); // startActivity(new Inten.. 더보기