zoukankan      html  css  js  c++  java
  • 另外一种写法的intent跳转

    public class Test extends ListActivity {

    private ArrayAdapter<Item> adapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Item[] items = {
    new Item(TestPanels.class, "Test Panels"),
    new Item(TestSwitcher.class, "Test Switcher"),
    new Item(TestSmoothButton.class, "Test SmoothButton"),
    new Item(TestInterpolators.class, "Test Interpolators"),
    new Item(TestTheme.class, "Test Theme"),
    new Item(TestVirtualKeyboard.class, "Test Virtual Keyboard"),
    new Item(TestCustomTitle.class, "Test Custom Title"),
    };
    adapter = new ArrayAdapter<Item>(this, R.layout.simple_list_item_1, items);
    setListAdapter(adapter);
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
    startActivity(adapter.getItem(position));
    }

    class Item extends Intent {
    String s;
    public Item(Class<?> c, String s) {
    super(Test.this, c);
    this.s = s;
    }

    @Override
    public String toString() {
    return s;
    }
    }
    }

  • 相关阅读:
    设计模式来替代if-else
    Cloneable接口的作用与深度克隆与浅度克隆
    IP地址分类
    MIME-TYPE
    Linux curl
    Cookie 跨域???
    冒烟测试
    @Valid、@Validated 、正则验证工具
    Node.js—第一个动态页面
    Node.js—小试牛刀-创建目录
  • 原文地址:https://www.cnblogs.com/ct732003684/p/2719342.html
Copyright © 2011-2022 走看看