Exemple #1
0
  public void init() {
    //		gallery_adapter=new hotelgalleryAdapter(context,
    // gallery_list);---------------------------广告位---------------------------------
    //		hotel_adapter=new hotelAdapter(context, hotel_list);

    hotel_adapter = new hotelAdapter(context, hotel_list);

    //	hotelGallery=(Gallery)findViewById(R.id.hotel_gallery);       广告栏
    //	hotel_View=(FlowIndicator)findViewById(R.id.hotel_view);  广告栏
    hotel_listview = (CommentListView) findViewById(R.id.hotel_list);
    //	hotel_gallery_layout=(FrameLayout)findViewById(R.id.hotel_gallery_layout);  广告栏

    //
    //	hotelGallery.setAdapter(gallery_adapter);---------------------------广告位---------------------------------
    hotel_listview.setAdapter(hotel_adapter);
  }
Exemple #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.hotel);
    hotel_list = new ArrayList<hotel>();
    hotel_con = new ArrayList<hotel>();
    // gallery_list=new
    // ArrayList<Album>();---------------------------广告位---------------------------------
    context = this;
    init();
    timer = new Timer();
    hotel_listview.setOnRefreshListener(this);
    onRefresh();
    //	new AlbumTask(this,
    // Gallery_index).execute(Start_Index);---------------------------广告位---------------------------------

    /*	---------------------------广告位---------------------------------*/
    /*		hotelGallery.setOnItemSelectedListener(new OnItemSelectedListener() {

    	@Override
    	public void onItemSelected(AdapterView<?> parent, View view,
    			int position, long id) {
    		hotel_View.setSeletion(position);


    	}

    	@Override
    	public void onNothingSelected(AdapterView<?> parent) {
    		// TODO Auto-generated method stub

    	}
    });
    hotelGallery.setOnItemClickListener(new  OnItemClickListener() {

    	@Override
    	public void onItemClick(AdapterView<?> parent, View view,
    			int position, long id) {


    	}
    }); */
    //	timer.scheduleAtFixedRate(new MyTask(), 5000,
    // 10000);---------------------------广告位---------------------------------

    hotel_listview.setOnScrollListener(
        new OnScrollListener() {

          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            visibleCount = visibleItemCount;
            visibleLast = firstVisibleItem + visibleItemCount - 1;
          }
        });
    hotel_listview.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            try {
              hotel hotel_detail = hotel_list.get(position);
              Log.d(
                  "hotel",
                  "---------------" + position + "----------" + hotel_detail.toString() + "");
              Intent it = new Intent(); // 创建Intent对象
              Bundle bundle = new Bundle(); // 创建Bundle对象
              it.setClass(hotelActivity.this, hoteldetailActivity.class);
              bundle.putSerializable("hotel_details", (Serializable) hotel_detail);
              Log.d("hotel_detail", hotel_detail.toString());
              it.putExtras(bundle);
              startActivity(it);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
  }