안녕하세요

외부에서 별도의 이벤트 없이 GridView안의 특정 인덱스에 위치한

TextView를 참조하는 코드를 작성중에 막히는 부분이 있어 질문을 올리게 되었습니다.

제가 구현한 어댑터 클래스 입니다.


class TextAdapter extends BaseAdapter{
   // private Context context;
   public String[] strDay = {"", "MON", "TUE", "WED", "THU", "FRI"};
   public String[] strTime = {"", "09 ~ 10", "10 ~ 11", "11 ~ 12", "12 ~ 13", "13 ~ 14", "14 ~ 15", "15 ~ 16"};
   // TextView 2차원 배열 선언
   public TextView[][] tv = new TextView[8][6];
  
   public TextAdapter(Context context){
      //  this.context = context;
      for(int i = 0; i < tv.length; i++){
         for(int j = 0; j < tv[i].length; j++){
            tv[i][j] = new TextView(context); 
         }
      }
   }

   @Override
      public int getCount() {
         return tv.length * tv[0].length;
      }

   @Override
   public View getView(int position, View convertView, ViewGroup parent) {
      int row = position / 6;
      int col = position % 6;
      if(convertView == null){
         tv[row][col].setLayoutParams(new GridView.LayoutParams(LayoutParams.FILL_PARENT, 37));
         tv[row][col].setGravity(Gravity.CENTER);
      if(position == 0){
         tv[row][col].setBackgroundColor(Color.BLACK);
      }else if(row == 0 || col == 0){
         tv[row][col].setBackgroundColor(Color.GREEN);
         tv[row][col].setTextColor(Color.BLACK);
         if(row == 0) tv[row][col].setText(strDay[col].toString());
         if(col == 0) tv[row][col].setText(strTime[row].toString());
      }else{
         tv[row][col].setBackgroundColor(Color.WHITE);
      }
   }else{
      tv[row][col] = (TextView)convertView;
   }
   return tv[row][col];
 }


※ onCreate 구현부

TextAdapter txtAdapter = new TextAdapter(this);
// GridView에 어댑터 연결 후 접근 테스트를 위한 Toast
Toast.makeText(Main.this, txtAdapter.tv[0][1].getText(), Toast.LENGTH_LONG).show();


※ 결과


배열 tv[0][1]의 TextView에는 "MON" 문자열이 세팅되어 있는데
위와 같은 방법을 이용하니 토스트 안에 빈 공간으로 출력이 됩니다.
setOnItemClickListener 이용시엔 제대로 나오지만
별도의 이벤트 없이 출력을 해야 하는 부분이라
고수님들의 조언을 듣고싶습니다.