이 블로그 검색

2011년 6월 2일 목요일

Exception Handling

모바일 어플리케이션은
3G 접속 등 네트워크 접속이 불안할 때, Server의 Data를 못 가져와서 프로그램이 다운되는 경우가 자주 있다. 이럴 때는 사실상 Exception 처리로서 해결해야한다.

예외 처리의 이유... 어플은 어떻케든 죽지만 않으면 된다.

* 예외 처리  -> try, catch
1. 예외 후보자를 try로 감싼다.
2. 기어이 예외를 내면 catch에서 처리한다.
3. "Exception e" 모든 Exception 객체의 왕언니. 다 받아준다. 따라서 맨 마지막 catch 문에
4. catch 문에서 ExceptionHandler 객체를 생성해 처리해 줄 수 도 있다.

2011년 5월 29일 일요일

세로로 스크롤 되는 텍스트 뷰 만들기

안드로이드 ... 가끔 이해 안되는 구석이 많다... ;;
꼭 아래와 같이 해야 되더라... ;;

<ScrollView android:id="@+id/scrollView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">   
<TextView
 android:id="@+id/subtitle"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />          
</ScrollView>

요렇게 해도 되긴 되네..
<ScrollView android:id="@+id/scrollView"
   android:layout_width="295dip"
   android:layout_height="390dip"
   android:background="@drawable/text_field_b_sel"
   android:layout_gravity="center_horizontal" 
>
<LinearLayout 
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
<TextView android:text="" 
android:layout_width="295dip"
android:layout_height="wrap_content"
android:id="@+id/textContent" 
android:paddingLeft="3.5dip"
   style="@style/color1_2_size16" android:layout_gravity="fill_vertical|center_horizontal"  >
</TextView>
</LinearLayout>
</ScrollView>

2011년 5월 24일 화요일

Android Activity 생명 주기에 대한 확실한 이해

http://eddykudo.com/63

여기 자세히 나와 있음.. ㅎㅎ

android.text.Html - 문자열에 색깔, 폰트, 밑줄 등을 변경 할 때

* 문자열에 색깔이나 폰트, 밑줄 등의 변경을 주고자 할 때,

android.text.Html 을 이용한다.

String s1 = s1 +"<font color=\"#ff8c00\">"+sortMinArr.get(i).substring(0, 2)+"&nbsp</font>"

위의 주황색처럼 HTML 형식으로 쓰고, 

Html.fromHtml(s1);  // -> s1을 나중에 Html.fromHtml로 감싸면 된다.

2011년 5월 6일 금요일

getView()를 다시 그리고 싶을때,

notifyDataSetChange : 변경된 View를 다시 그린다.
커스텀 리스트뷰에서 getView()를 재호출한다. !!

2011년 4월 26일 화요일

커스텀 뷰 만들시 커스텀어댑터에서 implement 되는 모든 메서드를 정확히 구현해야 한다.

 class CustomerAdapter extends BaseAdapter{
   
     Context maincon;
     LayoutInflater Inflater;
     ArrayList<Customer> vSource;
     int tlayout;
     
     CustomerAdapter(Context context, int targetLayout, ArrayList<Customer> sourceArr)
     {
      Log.i("Gilrs getneration", "서현" );
      maincon = context;
      Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      vSource = sourceArr;
      tlayout = targetLayout;
     }
   
  @Override
  public int getCount() {
   // TODO Auto-generated method stub
   return  vSource.size();
  }
  @Override
  public Object getItem(int position) {
   // TODO Auto-generated method stub
   return vSource.get(position).cusName;
  }

  @Override
  public long getItemId(int position) {
   // TODO Auto-generated method stub
   return position;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
   // TODO Auto-generated method stub
  
   Log.i("Gilrs getneration", "태연" );
   final int pos = position;
  
   if(convertView == null)
   {
    convertView = Inflater.inflate(tlayout,parent, false);
    Log.i("Gilrs getneration", "윤아" );
   }
  
   TextView txt = (TextView)convertView.findViewById(R.id.listcon);
   txt.setText(vSource.get(position).cusName);
  
   convertView.setOnClickListener(new View.OnClickListener() {
   
    @Override
    public void onClick(View v) {
     // TODO Auto-generated method stub
    
    }
   });
   return convertView;
  }

2011년 4월 14일 목요일

Second topic was so interesting since I've had a lot of interesting about evil of human. This topic was so familiar with me.
Series killer, psychopath, homicide, massacre and raping .... the dark and basic human instinct which is related to violence and cruelty. I don't know since when I began to realize that human beings are basically evil and selfish. From that time I gave up trusting and giving expectation to people. This makes me easy because no expectation brings no disappointment. Even no surprising to me seeing evil like Kim jung-il's  on North Korea.