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

    d_pb_ll = (LinearLayout) findViewById(R.id.data_progressbar_ll);
    dataUsedText = (TextView) findViewById(R.id.dataUsedText);
    mProgress = (ProgressBar) findViewById(R.id.percentDataUsed);
    dell = (LinearLayout) findViewById(R.id.data_error);
    detv = (TextView) findViewById(R.id.tv_failure);
    deb = (Button) findViewById(R.id.button_send_data);
    actionbar = getSupportActionBar();
    actionbar.setTitle("Data Usage");
    actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionbar.setHomeButtonEnabled(true);
    actionbar.setDisplayHomeAsUpEnabled(true);

    graph = (XYPlot) findViewById(R.id.mySimpleXYPlot);
    graph.setOnTouchListener(this);
    graph.setMarkupEnabled(false);

    labels = new Long[288];
    downdata = new Float[288];
    totaldata = new Float[288];

    httpclient = ConnectionHelper.getThreadSafeClient();
    httpclient.getCookieStore().clear();
    BasicClientCookie cookie =
        new BasicClientCookie("AUTHCOOKIE", ConnectionHelper.getPNAAuthCookie(this, httpclient));
    cookie.setDomain(".pna.utexas.edu");
    httpclient.getCookieStore().addCookie(cookie);
    new fetchDataTask(httpclient).execute();
    new fetchProgressTask(httpclient).execute();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);

    courseID = getArguments().getString("courseID");
    courseName = getArguments().getString("courseName");
    viewUri = getArguments().getString("viewUri");
    itemName = getArguments().getString("itemName");

    setHasOptionsMenu(true);

    attachments = new ArrayList<bbFile>();
    attachmentAdapter = new dlableItemAdapter(getSherlockActivity(), attachments);
    content = "";

    client = ConnectionHelper.getThreadSafeClient();
    BasicClientCookie cookie =
        new BasicClientCookie(
            "s_session_id", ConnectionHelper.getBBAuthCookie(getSherlockActivity(), client));
    cookie.setDomain("courses.utexas.edu");
    client.getCookieStore().addCookie(cookie);
  }