• 02_ListActive中响应事件 并LogCat输出


    AndroidManifest.xml  中设置 主Active

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.game_01_listview"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
            android:minSdkVersion="7"
            android:targetSdkVersion="17" />

        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.example.game_01_listview.AndroidBasicsStarter"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

    </manifest>

    AndroidBasicsStarter.java   实现ListActive绑定并LogCat输出


    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 android.util.Log;
    public class AndroidBasicsStarter extends ListActivity {
        String tests[] = { "LifeCycleTest", "SingleTouchTest", "MultiTouchTest",
                "KeyTest", "AccelerometerTest", "AssetsTest",
                "ExternalStorageTest", "SoundPoolTest", "MediaPlayerTest",
                "FullScreenTest", "WakeLockTest", "RenderViewTest", "ShapeTest", "BitmapTest",
                "FontTest", "SurfaceViewTest" };

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setListAdapter(new ArrayAdapter<String>(this,
                    android.R.layout.simple_list_item_1, tests));
        }

        @Override
        protected void onListItemClick(ListView list, View view, int position,
                long id) {
            super.onListItemClick(list, view, position, id);
            String testName = tests[position];
            Log.i(testName,testName);
        }
    }

  • 相关阅读:
    关于String重写的hashcode的代码分析
    自定义HashSet判重标准
    idea-Java文件结构
    java 带静态域的导出类创建时都发生了什么?
    seo初学
    关于事件冒泡和事件委托
    关于本地$.get(url,function(data)),异步获取数据
    FileReader上传图片
    关于随机生成颜色
    C语言贪吃蛇
  • 原文地址:https://www.cnblogs.com/xl711436/p/3060192.html
Copyright © 2020-2023  润新知