Jump to different activity by different needs

Source: Internet
Author: User

The code is as follows:

/* Android asynchronous Http Client Sample Copyright (c) Marek Sebera <[email protected]>/http    Loopj.com Licensed under the Apache License, Version 2.0 (the "License");    You are not a use of this file except in compliance with the License.  Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable Law or agreed into writing, software distributed under the License is distributed on a "as is" BASIS, without WAR    Ranties or CONDITIONS of any KIND, either express OR implied. See the License for the specific language governing permissions and limitations under the License.*/package com.loopj.a Ndroid.http.sample;import Android.app.listactivity;import Android.content.intent;import Android.os.Bundle;import Android.view.view;import Android.widget.arrayadapter;import Android.widget.listview;import java.util.ArrayList; Import Java.util.list;public class Waypointsactivity extends Listactivity {    private static final sampleconfig[] Samplesconfig = new sampleconfig[]{new Sampleconfig (r.string.title_get _sample, Getsample.class), New Sampleconfig (R.string.title_post_sample, Postsample.class), new Sampl Econfig (R.string.title_delete_sample, Deletesample.class), New Sampleconfig (R.string.title_put_sample, PutSampl E.class), New Sampleconfig (R.string.title_patch_sample, Patchsample.class), New Sampleconfig (R.strin G.title_json_sample, Jsonsample.class), New Sampleconfig (R.string.title_json_streamer_sample, JsonStreamerSampl E.class), New Sampleconfig (R.string.title_sax_example, Saxsample.class), New Sampleconfig (r.string.t            Itle_file_sample, Filesample.class), New Sampleconfig (R.string.title_binary_sample, Binarysample.class), New Sampleconfig (R.string.title_gzip_sample, Gzipsample.class), New Sampleconfig (r.string.title_redirect_3 redirect302sample.cl,), New Sampleconfig (R.string.title_threading_timeout, Threadingtimeoutsample.class), new Sampleco Nfig (R.string.title_cancel_all, Cancelallrequestssample.class), New Sampleconfig (R.string.title_cancel_handle,            Cancelrequesthandlesample.class), New Sampleconfig (R.string.title_synchronous, Synchronousclientsample.class), New Sampleconfig (R.string.title_intent_service_sample, Intentservicesample.class), New Sampleconfig ( R.string.title_post_files, Filessample.class), New Sampleconfig (R.string.title_persistent_cookies, PersistentCo Okiessample.class), New Sampleconfig (R.string.title_custom_ca, Customcasample.class), new sampleconf IG (R.string.title_retry_handler, Retryrequestsample.class), New Sampleconfig (R.string.title_range_sample, Range Responsesample.class), New Sampleconfig (R.string.title_401_unauth, Http401authsample.class), new Sam Pleconfig (R.string.title_pre_post_processing, Prepostprocessingsample.class), New Sampleconfig (R.string.title_content_type_http_entity, Contenttypeforhttpentitysample.class), New Sampleconfig (R.string.title_resume_download, ResumeDownloadSample.c Lass), New Sampleconfig (R.string.title_digest_auth, Digestauthsample.class), New Sampleconfig (R.stri    Ng.title_use_pool_thread, Usepoolthreadsample.class)};        @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setlistadapter (New arrayadapter<string> (this, Android.    R.layout.simple_list_item_1, Gettitleslist ()));        } private list<string> Gettitleslist () {list<string> titles = new arraylist<string> ();        for (Sampleconfig config:samplesconfig) {Titles.add (getString (Config.titleid));    } return titles; } @Override protected void Onlistitemclick (ListView l, View v, int position, long ID) {       if (position >= 0 && Position < samplesconfig.length) StartActivity (new Intent (This, Sampl    Esconfig[position].targetclass));        } private static class Sampleconfig {final int titleid;        Final Class Targetclass;            Sampleconfig (int titleid, Class targetclass) {This.titleid = TitleID;        This.targetclass = Targetclass; }    }}

  

Jump to different activity by different needs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.