Exemple #1
0
  public void initView(final Context mContext, View view) {
    items = getItems();
    title = (TextView) view.findViewById(R.id.general_title);
    listView = (NoScrollListView) view.findViewById(R.id.general_listview);
    more = (RelativeLayout) view.findViewById(R.id.rl_general_more);
    title.setText(getTitleNode().getText());
    listView.setAdapter(new RecommendAdapter(mContext, items));
    Utils.setListViewHeightBasedOnChildren(listView);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            AbstractAction action = items.get(position).getAction();
            if (action != null) {
              action.jumpByActionType(action.getParaMap());
            }
          }
        });
    more.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent it = new Intent(mContext, BaodianActivity.class);
            // it.putExtra("catalogId", getCatalogIdNode().getText());
            mContext.startActivity(it);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    View view = inflater.inflate(R.layout.fragment_all_question, null);
    Utils.hideSoftInput(this.getActivity());
    initView(view);
    initListener();
    getActivity()
        .registerReceiver(
            new BroadcastReceiver() {

              @Override
              public void onReceive(Context context, Intent intent) {
                // TODO Auto-generated method stub
                new QuestQuestionTask(true, false).execute();
              }
            },
            new IntentFilter(LivingActivity.REFRESH_QUESTION_ACTION));
    return view;
  }