0

こんにちは、Android アプリのリスト メニューを作成し、メニューがリンクする他のアクティビティを作成しましたが、それを実行してリスト項目をクリックすると、他のアクティビティにリンクされません。

コードはこちら

menu.java (更新)

                            package com.example.taekwondobuddy.util;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;


public class Menu extends ListActivity {

String classes[] = {"Tool","Techniques"} ;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setListAdapter(new ArrayAdapter<String>(Menu.this, android.R.layout.simple_list_item_1, classes));
}


@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
    String cheese = classes[position];
    try{
    Class ourclass = Class.forName("com.example.taekwondobuddy" + cheese);
    Intent ourIntent = new Intent(Menu.this, ourclass);
    startActivity(ourIntent);
    } catch(ClassNotFoundException e){
        e.printStackTrace();

    }
}

Tools.java

                 package com.example.taekwondobuddy.util;

                import android.app.ListActivity;
                import android.content.Intent;
               import android.os.Bundle;
               import android.view.View;
                import android.widget.ArrayAdapter;
           import android.widget.ListView;

     public class Tools extends ListActivity{

String classes[] = {"Counter","Accelermeter","Timer"} ;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setListAdapter(new ArrayAdapter<String>(Tools.this, android.R.layout.simple_list_item_1, classes));
}


@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
    String cheese = classes[position];
    try{
    Class ourclass = Class.forName("com.example.taekwondobuddy" + cheese);
    Intent ourIntent = new Intent(Tools.this, ourclass);
    startActivity(ourIntent);
    } catch(ClassNotFoundException e){
        e.printStackTrace();

    }
}

       }    

Technquiues.java

                package com.example.taekwondobuddy.util;

            import android.app.ListActivity;
            import android.content.Intent;
           import android.os.Bundle;
          import android.view.View;
       import android.widget.ArrayAdapter;
            import android.widget.ListView;

         public class Technqiues extends ListActivity {

String classes[] = {"Kicks","Sparring",} ;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setListAdapter(new ArrayAdapter<String>(Technqiues.this, android.R.layout.simple_list_item_1, classes));
}


@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
    String cheese = classes[position];
    try{
    Class ourclass = Class.forName("com.example.taekwondobuddy" + cheese);
    Intent ourIntent = new Intent(Technqiues.this, ourclass);
    startActivity(ourIntent);
    } catch(ClassNotFoundException e){
        e.printStackTrace();

    }
}

    }

マニフェスト

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

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.taekwondobuddy.util.Menu"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.taekwondobuddy.util.Tools"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme" >
        <intent-filter>
            <action android:name="android.intent.action.Tools" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.taekwondobuddy.util.Techniques"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme" >
        <intent-filter>
            <action android:name="android.intent.action.Techniques" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>


</manifest>

何が問題なのですか?

4

2 に答える 2

0

タグ /intent-filter
内を次のように変更し ますintent-filter
action android:name="android.intent.action.Tools


android:name="com.example.taekwondobuddy.util.Tools";

于 2013-10-17T02:24:21.043 に答える