Android 我不断收到错误致命异常。无法实例化活动

Android 我不断收到错误致命异常。无法实例化活动,android,Android,致命异常 E/AndroidRuntime535:java.lang.RuntimeException:无法实例化活动组件信息{com.This.Calculator/com.This.Calculator.BatteryCalculatorActivity}:java.lang.ClassNotFoundException:com.This.Calculator.ThisBatteryCalculatorActivity 我只是在学习Android开发者关于Tab View的教程,我想我是按照

致命异常 E/AndroidRuntime535:java.lang.RuntimeException:无法实例化活动组件信息{com.This.Calculator/com.This.Calculator.BatteryCalculatorActivity}:java.lang.ClassNotFoundException:com.This.Calculator.ThisBatteryCalculatorActivity

我只是在学习Android开发者关于Tab View的教程,我想我是按照这个教程来学习的。。。但我似乎没有。有人能帮我吗? 顺便说一句,我正在使用eclipse

这是我的密码:

对于ThisBatteryCalculator

  package com.This.Calculator;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;



@SuppressWarnings("deprecation")
public class ThisBatteryCalculator extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Resources res = getResources(); // Resource object to get Durables
    TabHost tabHost = getTabHost();  // The activity TabHost
    TabHost.TabSpec spec;  // Reusable TabSpec for each tab
    Intent intent;  // Reusable Intent for each tab

    // Create an Intent to launch an Activity for the tab (to be reused)
    intent = new Intent().setClass(this, ArtistsActivity.class);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost.newTabSpec("artists").setIndicator("Artists",
                      res.getDrawable(R.drawable.ic_tab_artists))
                  .setContent(intent);
    tabHost.addTab(spec);

    // Do the same for the other tabs
    intent = new Intent().setClass(this, AlbumsActivity.class);
    spec = tabHost.newTabSpec("albums").setIndicator("Albums",
                      res.getDrawable(R.drawable.ic_tab_albums))
                  .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, SongActivity.class);
    spec = tabHost.newTabSpec("songs").setIndicator("Songs",
                      res.getDrawable(R.drawable.ic_tab_songs))
                  .setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(2);
}
}
对于我的舱单:

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

<uses-sdk android:minSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".ThisBatteryCalculatorActivity"          
        android:label="@string/app_name" >
        android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
 </activity>
        <activity android:name=".ArtistsActivity"
          android:label="@string/app_name" 
          android:theme="@android:style/Theme.NoTitleBar">
</activity>

<activity android:name=".SongActivity"
          android:label="@string/app_name" 
          android:theme="@android:style/Theme.NoTitleBar">
</activity>

<activity android:name=".AlbumsActivity"
          android:label="@string/app_name" 
          android:theme="@android:style/Theme.NoTitleBar">
</activity>

</application>



</manifest>
最后,对于my main.xml:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />
</LinearLayout>
</TabHost>

任何帮助都将不胜感激!谢谢大家!

在清单中,您将ThisBatteryCalculator活动作为活动类的名称

在源代码中,您将ThisBatteryCalculator作为活动类的名称

此BatteryCalculator活动和此BatteryCalculator不相同。它们必须是一样的。你选择哪一个取决于你自己。将该类重命名为ThisBatteryCalculator活动或调整清单以引用ThisBatteryCalculator