태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

int sizey=10;
int sizex=10;
int btnwidth=24;
TableLayout tl = (TableLayout)findViewById(R.id.MyTableLayout); 

for (int y=0;y<sizey;y++){

// Rows
TableRow tr = new TableRow(this);
tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));

//Cells
for (int x=0;x<sizex;x++){
// Create new cell
    // new button
    Button b = new Button(this);
    b.setText(x+""+y);
    b.setLayoutParams(new LayoutParams(
        LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT));
    b.setHeight(btnwidth);
    b.setBackgroundResource(R.drawable.btn_blue);
    b.setOnClickListener(new PegOnClickListener(y,x));
    // add button to row
    tr.addView(b);
    }
// add row to layout
tl.addView(tr,new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
}
}

위와 같은 형태로 동적으로 행을 추가 한다고 가정 했을 경우에 또는 몇 가지만 추가한 다고 했을 경우에 화면이 안나타나는 경우가 있다.

 

그 때는 import 구문을 잘 살펴보고 해당 Layout에 맞는 LyaoutParams 클래스가 맞는지 확인이 필요합니다.

위와 같이 TableLayout일 경우에는 LayoutParams의 import가

import android.widget.TableRow.LayoutParams;

와 같이 되어야 합니다. 이클립스 adt를 사용해서 하다가 보면 엉뚱한 LinerLayout같은 걸로 들어가 있게 되는 경우가 있는데 이럴 땐 화면이 나오질 않습니다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 때찌1

ApiDemo/Views/Expandable Lists/1. custom Adapter

image

소스

이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 때찌1

특정 화면을 진행하다가 보면 해당 화면의 결과를 해당 화면을 콜했던 화면에서 받아봐야 할 경우가 있다. 그 때에 사용하는 onActivityResult(int i, int i) 메소드가 있다.

그리고 특정 값을 넘기는 방법도 있는데 이 부분은 추후 진행하겠다.

 

소스는 Android sample로 진행한다.

   1:  /*
   2:   * Copyright (C) 2007 The Android Open Source Project
   3:   *
   4:   * Licensed under the Apache License, Version 2.0 (the "License");
   5:   * you may not use this file except in compliance with the License.
   6:   * You may obtain a copy of the License at
   7:   *
   8:   *      http://www.apache.org/licenses/LICENSE-2.0
   9:   *
  10:   * Unless required by applicable law or agreed to in writing, software
  11:   * distributed under the License is distributed on an "AS IS" BASIS,
  12:   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13:   * See the License for the specific language governing permissions and
  14:   * limitations under the License.
  15:   */
  16:   
  17:  package com.example.android.apis.app;
  18:   
  19:  // Need the following import to get access to the app resources, since this
  20:  // class is in a sub-package.
  21:  import java.util.Map;
  22:   
  23:  import com.example.android.apis.R;
  24:   
  25:  import android.app.Activity;
  26:  import android.content.Intent;
  27:  import android.text.Editable;
  28:  import android.os.Bundle;
  29:  import android.view.View;
  30:  import android.view.View.OnClickListener;
  31:  import android.widget.Button;
  32:  import android.widget.TextView;
  33:   
  34:  import java.util.Map;
  35:   
  36:  /**
  37:   * Shows how an activity can send data to its launching activity when done.y.
  38:   * <p>This can be used, for example, to implement a dialog alowing the user to
  39:  pick an e-mail address or image -- the picking activity sends the selected
  40:  data back to the originating activity when done.</p>
  41:  
  42:  <p>The example here is composed of two activities: ReceiveResult launches
  43:  the picking activity and receives its results; SendResult allows the user
  44:  to pick something and sends the selection back to its caller.  Implementing
  45:  this functionality involves the
  46:  {@link android.app.Activity#setResult setResult()} method for sending a
  47:  result and
  48:  {@link android.app.Activity#onActivityResult onActivityResult()} to
  49:  receive it.</p>
  50:  
  51:  <h4>Demo</h4>
  52:  App/Activity/Receive Result
  53:   
  54:  <h4>Source files</h4>
  55:  <table class="LinkTable">
  56:          <tr>
  57:              <td class="LinkColumn">src/com.example.android.apis/app/ReceiveResult.java</td>
  58:              <td class="DescrColumn">Launches pick activity and receives its result</td>
  59:          </tr>
  60:          <tr>
  61:              <td class="LinkColumn">src/com.example.android.apis/app/SendResult.java</td>
  62:              <td class="DescrColumn">Allows user to pick an option and sends it back to its caller</td>
  63:          </tr>
  64:          <tr>
  65:              <td class="LinkColumn">/res/any/layout/receive_result.xml</td>
  66:              <td class="DescrColumn">Defines contents of the ReceiveResult screen</td>
  67:          </tr>
  68:          <tr>
  69:              <td class="LinkColumn">/res/any/layout/send_result.xml</td>
  70:              <td class="DescrColumn">Defines contents of the SendResult screen</td>
  71:          </tr>
  72:  </table>
  73:  
  74:   */
  75:  public class ReceiveResult extends Activity {
  76:      /**
  77:       * Initialization of the Activity after it is first created.  Must at least
  78:       * call {@link android.app.Activity#setContentView setContentView()} to
  79:       * describe what is to be displayed in the screen.
  80:       */
  81:      @Override
  82:      protected void onCreate(Bundle savedInstanceState) {
  83:          // Be sure to call the super class.
  84:          super.onCreate(savedInstanceState);
  85:   
  86:          // See assets/res/any/layout/hello_world.xml for this
  87:          // view layout definition, which is being set here as
  88:          // the content of our screen.
  89:          setContentView(R.layout.receive_result);
  90:   
  91:          // Retrieve the TextView widget that will display results.
  92:          mResults = (TextView)findViewById(R.id.results);
  93:   
  94:          // This allows us to later extend the text buffer.
  95:          mResults.setText(mResults.getText(), TextView.BufferType.EDITABLE);
  96:   
  97:          // Watch for button clicks.
  98:          Button getButton = (Button)findViewById(R.id.get);
  99:          getButton.setOnClickListener(mGetListener);
 100:      }
 101:   
 102:      /**
 103:       * This method is called when the sending activity has finished, with the
 104:       * result it supplied.
 105:       * 
 106:       * @param requestCode The original request code as given to
 107:       *                    startActivity().
 108:       * @param resultCode From sending activity as per setResult().
 109:       * @param data From sending activity as per setResult().
 110:       */
 111:      @Override
 112:      protected void onActivityResult(int requestCode, int resultCode,
 113:          Intent data) {
 114:          // You can use the requestCode to select between multiple child
 115:          // activities you may have started.  Here there is only one thing
 116:          // we launch.
 117:          if (requestCode == GET_CODE) {
 118:   
 119:              // We will be adding to our text.
 120:              Editable text = (Editable)mResults.getText();
 121:   
 122:              // This is a standard resultCode that is sent back if the
 123:              // activity doesn't supply an explicit result.  It will also
 124:              // be returned if the activity failed to launch.
 125:              if (resultCode == RESULT_CANCELED) {
 126:                  text.append("(cancelled)");
 127:   
 128:              // Our protocol with the sending activity is that it will send
 129:              // text in 'data' as its result.
 130:              } else {
 131:                  text.append("(okay ");
 132:                  text.append(Integer.toString(resultCode));
 133:                  text.append(") ");
 134:                  if (data != null) {
 135:                      text.append(data.getAction());
 136:                  }
 137:              }
 138:   
 139:              text.append("\n");
 140:          }
 141:      }
 142:   
 143:      // Definition of the one requestCode we use for receiving resuls.
 144:      static final private int GET_CODE = 0;
 145:   
 146:      private OnClickListener mGetListener = new OnClickListener() {
 147:          public void onClick(View v) {
 148:              // Start the activity whose result we want to retrieve.  The
 149:              // result will come back with request code GET_CODE.
 150:              Intent intent = new Intent(ReceiveResult.this, SendResult.class);
 151:              startActivityForResult(intent, GET_CODE);
 152:          }
 153:      };
 154:   
 155:      private TextView mResults;
 156:  }
 157:   
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 때찌1

Naming rule

  • 공통

    • And의 의미는’N’으로 사용한다.

      • callAcountViewNEdit

    • method는 알기 쉽게 길게 풀어서 쓴다.

      • ex:callAccountViewForCreate/callAccountViewNEdit

  • UI

    • 클래스는 마지막에 View로 끝난다.

    • 해당 클래스 호출은 call로 시작한다.

  • 조회 method

    • select로 시작한다.

  • 생성 method

    • create로 시작한다.

  • 저장(수정/등록) method

    • save로 시작한다.

 

기본적인 펜 & 페이퍼 모델링

계좌관리뷰(ManageAccountView)

  • 등록된 계좌목록 조회

  • 목록 중에서 특정계좌 조회 및 수정

  • 신규로 계좌등록

    • 신규로 등록할 때는 저장 파일에 ‘0”을 붙여서 생성하기로 한다. (그런데 이거 ‘0’이 들어갈 수 있나?)

계좌뷰(AccountView)

  • 계좌 정보 보기-getAccount

  • 계좌 수정-clickAccount

계좌관리(AccountManage)

 

자료(Data)

계좌자료항목-AccountVO

  • 계좌명-accountName

  • 은행명-bankName

  • 계좌번호-accountNumber

  • 인터넷 뱅킹 아이디-bankingId

  • 인터넷 뱅킹 비밀번호-bankingPassword

  • 은행 대표번호-bankTel

  • 은행 홈페이지-bankHomepage

  • 메모-memo

  • 보안카드명-safeCardName(FK)

보안카드항목-SafeCardVO

  • 보안카드명-safeCardName

  • 은행명-bankName

  • 일련번호(number)-safeCardNumber

  • 가로사이즈(number)-width

  • 세로사이즈(number)-height

  • 계좌명-accountName

  • 메모-memo

기타카드항목-OtherCardVO

  • 카드명-cardName
  • 카드번호-cardNumber
  • 메모-memo
  • 바코드(picture)
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 때찌1

android sdk and avd manager를 설치하고 최초에 update하면서 제목과 같은 오류가 발생할 경우에 이렇게 하니까 해결이 되었다.

참고로 원인은 모름.

 

 

Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: HTTPS SSL error.
You might want to force download through HTTP in the settings.

위와 같은 오류가 발생했을 경우

c:\Documents and Settings\피씨명\.android 디렉토리에 가상의 “androidtool.cfg”파일을 만들어 주고 해당 파일 안에

sdkman.force.http=true

위와 같이 넣어주면 업데이트가 정상적으로 이루어졌다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 때찌1
이전버튼 1 이전버튼