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;
    }
    }
    }

  • 相关阅读:
    Linux进程管理概述
    【反转单链表】一篇就够了
    线性数据结构
    Linux的su和sudo有什么区别?如何使用?
    关于CentOS切换中文输入法的问题
    MySQL 初识
    MySQL 增-删-改操作
    数据库简介
    MySQL 查询操作
    HANDLER Statement
  • 原文地址:https://www.cnblogs.com/ct732003684/p/2719342.html
Copyright © 2011-2022 走看看