zoukankan      html  css  js  c++  java
  • 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);
        }
    }

  • 相关阅读:
    ruby中的特殊字符
    android and webview
    ActiveRecord::Base.establish_connection
    Ruby 创建目录
    不能手动输入或粘贴
    eclipse找不到 help>software update>find and install
    PL/SQL 创建、查看、操作用户
    XML文件
    javascript 获取页面高度(多种浏览器)(转)
    Eclipse to android
  • 原文地址:https://www.cnblogs.com/xl711436/p/3060192.html
Copyright © 2011-2022 走看看