Ejemplo n.º 1
0
 private void getInforPirce() {
   HttpUtil.get(
       Resource.url + "/IKnow/QuestionAction/Status" + "?sign=price",
       new JsonHttpResponseHandler() {
         public void onSuccess(int statusCode, Header[] headers, String responseBody) {
           super.onSuccess(statusCode, headers, responseBody);
           quenstionlist = JSON.parseArray(responseBody, QuestionBean.class);
           expenseadapter.setList(quenstionlist);
           expenseadapter.notifyDataSetChanged();
         }
       });
 }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.square_content);
    initView();
    initPopupWindow();

    HttpUtil.get(
        Resource.url + "/IKnow/QuestionAction/Status",
        new JsonHttpResponseHandler() {
          public void onSuccess(int statusCode, Header[] headers, String responseBody) {
            super.onSuccess(statusCode, headers, responseBody);
            quenstionlist = JSON.parseArray(responseBody, QuestionBean.class);
            expenseadapter = new ExpensiveAdapter(getApplicationContext(), quenstionlist);
            expense.setAdapter(expenseadapter);
            loading.setVisibility(View.GONE);
          }
        });

    expense.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(SquareFragment.this, AnswerFragment.class);
            intent.putExtra("id", quenstionlist.get(position - 1).getQuestionid());
            startActivity(intent);
          }
        });

    expense.setOnRefreshListener(
        new OnRefreshListener() {

          public void onRefresh() {
            HttpUtil.get(
                Resource.url + "/IKnow/QuestionAction/Status",
                new JsonHttpResponseHandler() {
                  public void onSuccess(int statusCode, Header[] headers, String responseBody) {
                    super.onSuccess(statusCode, headers, responseBody);
                    quenstionlist = JSON.parseArray(responseBody, QuestionBean.class);
                    expenseadapter.notifyDataSetChanged();
                    expense.setAdapter(expenseadapter);
                    expense.refreshComplete();
                  }
                });
          }
        });
  }