コード例 #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.course);

    viewInflater = getLayoutInflater();
    client = app.getClient();
    displayCourse();
    createMenu();

    announcementView.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            if (announcements != null && announcements.size() > 0) {
              Intent i = new Intent(CourseActivity.this, AnnouncementActivity.class);
              i.putExtra(AnnouncementActivity.COURSE_EXTRA, course);
              i.putExtra(AnnouncementActivity.ANNOUNCEMENT_EXTRA, announcements.get(0));
              i.putExtra(AnnouncementActivity.FINISH_ON_CLICK_ALL_ANNOUNCEMENTS_EXTRA, false);
              startActivity(i);
            }
          }
        });

    loadAndDisplayInstructorsForCourse();
    loadAndDisplayAnnouncementsForCourse();
  }
コード例 #2
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Class<? extends ECollegeActivity> destinationClass;
   String detailExtraKey = null;
   Serializable detailExtraValue = null;
   switch (position) {
     case 0:
       destinationClass = CourseAnnouncementsActivity.class;
       detailExtraKey = ANNOUNCEMENT_LIST_EXTRA;
       detailExtraValue = (Serializable) announcements;
       break;
     case 1:
       destinationClass = CourseGradebookActivity.class;
       break;
     case 2:
       destinationClass = CoursePeopleActivity.class;
       break;
     default:
       return;
   }
   Intent intent = new Intent(this, destinationClass);
   intent.putExtra(CoursesActivity.COURSE_EXTRA, course);
   if (detailExtraKey != null && detailExtraValue != null) {
     intent.putExtra(detailExtraKey, detailExtraValue);
   }
   startActivity(intent);
 }