コード例 #1
0
  public void displayInfo(String[] data) {
    TextView body = (TextView) findViewById(R.id.body);
    TextView title = (TextView) findViewById(R.id.title);
    TextView description = (TextView) findViewById(R.id.description);
    TextView school = (TextView) findViewById(R.id.school);
    TextView dep = (TextView) findViewById(R.id.fixed);
    CollapsingToolbarLayout toolbar = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
    switch (data[0]) {
      case "8":
      case "9":
      case "11":
      case "14":
        school.setText("School of Engineering");
        break;
      case "6":
      case "12":
      case "34":
      case "7":
        school.setText("School of Science");
        break;
      case "19":
        school.setText("Engineering/Science");
        break;
      case "3":
        school.setText("Library");

        break;
      case "1":
        school.setText("Central Perk");
        toolbar.setBackgroundResource(R.drawable.square);
        break;
      case "2":
        school.setText("Administration");
        toolbar.setBackgroundResource(R.drawable.ku);
        break;
      case "35":
        dep.setText("Nepal");
        school.setText("Department of Information Technology");
        toolbar.setBackgroundResource(R.drawable.itpark);
        break;
      default:
        school.setText("Blocks");
        break;
    }
    body.setText(data[3]);
    title.setText(data[1]);
    if (data[2] != null) {
      description.setText(data[2]);
    }
  }