-4

以下は私のコードです。テキストに特定の値のみを表示したいのですが、クリックすると完全な値を表示すると、この参照は アンドロイドを助けません特定の文字列から文字列を減算する方法

               Button e01;
              String value;

            String[] days = new String[7];

             for (int i = 0; i < 7; i++) {


         Log.d("TAG",df.format(calendarGlobal.getTime()));
         days[i] = df.format(calendarGlobal.getTime());  

              //i want to display only 11
              days[1]=    // 2013/09/11
         String[] stringArray = days[1].split("/");
         String elevenString = stringArray[stringArray.length-1];

    e01.setText(elevenString);
    e01.setTag(days[1]);


    //e01.setText(elevenString); show error if i replace  /e01.setText(elevenString);
   ///   with  e01.setTag(days[1]);  is show same value on text and on click on toast i 
  //  want  to show only"11" on e01.setText("11");
  //  when click on e01 show full value on Toast   // 2013/09/11

                  @Override
        public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {

      case R.id.e01:


      value = e01.getTag().toString();
             Toast.makeText(this, value, Toast.LENGTH_SHORT)    .show();








              public void calculateWeek(int currentweekno) {
    // TODO Auto-generated method stub
 //   days.clear();
    // Set the calendar to monday of the current week
    // calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
     calendarGlobal = Calendar.getInstance();
    DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    calendarGlobal.add(Calendar.WEEK_OF_YEAR, +currentweekno);
    calendarGlobal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
    String[] days = new String[7];
    for (int i = 0; i < 7; i++) {
     //   days.add(df.format(calendarGlobal.getTime()));
         Log.d("TAG",df.format(calendarGlobal.getTime()));
         days[i] = df.format(calendarGlobal.getTime());




        e01.setText("11");
         e01.setTag(days[1]);
4

1 に答える 1