tailieunhanh - lập trình android (phần 3)

Tham khảo tài liệu 'lập trình android (phần 3)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 76 Chapter 3 User interfaces return featureId item Override protected void onListItemClick ListView l View v Override . int position long id ----1 onListItemClick RestaurantFinderApplication application RestaurantFinderApplication getApplication position Intent intent new Intent Constants. INTENT_ACTION_VIEW_DETAIL getIntent .getIntExtra 1 startActivity intent Pass startFrom F extra value private void loadReviews String location String cuisine Get Application object and set state int startFrom final ReviewFetcher rf new ReviewFetcher location Create loadReviews method cuisine ALL startFrom this Working. Instantiate ReviewFetcher instance Retrieving reviews true new Thread --- public void run reviews O .start false Show ProgressDialog Make web service call Update handler o This Activity has a menu item that allows the user to get the next page of results or change the list criteria. To support this we have to implement the onMenultemSe-lected method O. If the MENU_GET_NEXT_PAGE menu item is selected we then define a new intent to reload the screen with an incremented startFrom value and we use the getExtras and putExtras intent methods to do this . After the menu-related methods we see a special onListItemClick method . This method is used to respond when one of the list items in a Listview is clicked. Here we use the position of the clicked item to reference the particular Review item the user chose and we set this into the Application for later usage in the ReviewDetail Activity which we will begin to implement in section . After we have the data set we then call the next Activity including the startFrom extra . Lastly in the ReviewList class we have the loadReviews method which strangely enough loads reviews . .

TỪ KHÓA LIÊN QUAN