我試圖訪問圖書館活動到另一個項目(在tabhost 和每個標籤調用不同的活動。),但其拋異常訪問圖書館活動無法在另一個項目
Caused by: android.content.ActivityNotFoundException: Unable to find
explicit activity class
{com.themontcalm.droid.activity/com.themontcalm.droid.lib.activity.ReservationTab};
have you declared this activity in your AndroidManifest.xml?
其中: -
com.themontcalm.droid.lib.activity.ReservationTab
是一個 圖書館項目。而com.themontcalm.droid.activity
發射 項目我在哪裏訪問圖書館活動代碼我在哪裏訪問我的項目庫:---
package com.themontcalm.droid.activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TabHost;
public class HomeScreen extends TabActivity implements OnClickListener {
TabHost tabHost;
ImageButton location, contacts, explore;
Intent intent;
//LocationGB locationActivity = new LocationGB();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_screen);
//LocationFactory.getInstance().setLocationActivity(LocationGB.class);
// addListenerOnButton();
location = (ImageButton) findViewById(R.id.location);
contacts = (ImageButton) findViewById(R.id.contacts);
explore = (ImageButton) findViewById(R.id.explore);
location.setOnClickListener(this);
contacts.setOnClickListener(this);
explore.setOnClickListener(this);
Resources res = getResources(); // Resource object to get Drawables
// The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost = getTabHost();
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(getBaseContext(), com.themontcalm.droid.lib.activity.ReservationTab.class);
spec = tabHost.newTabSpec("RESERVATION")
.setIndicator("", res.getDrawable(R.drawable.testing))// ,
// res.getDrawable(R.drawable.testing)
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, com.themontcalm.droid.lib.activity.GalleryTabActivity.class);
spec = tabHost.newTabSpec("MODIFY")
.setIndicator("", res.getDrawable(R.drawable.testing))// ,res.getDrawable(R.drawable.testing)
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, com.themontcalm.droid.lib.activity.VideoTabActivity.class);
spec = tabHost.newTabSpec("VIDEO")
.setIndicator("", res.getDrawable(R.drawable.testing))// ,
// res.getDrawable(R.drawable.testing)
.setContent(intent);
tabHost.addTab(spec);
// set tab which one you want open first time 0 or 1 or 2
tabHost.setCurrentTab(0);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == location) {
// intent = new Intent(HomeScreen.this, LocationGB.class);
// HomeScreen.this.startActivity(intent);
} else if (v == contacts) {
intent = new Intent(HomeScreen.this, com.themontcalm.droid.lib.activity.ContactInfo.class);
HomeScreen.this.startActivity(intent);
} else if (v == explore) {
intent = new Intent(HomeScreen.this, com.themontcalm.droid.lib.activity.ExplorePropertyActivity.class);
HomeScreen.this.startActivity(intent);
}
}
}
您是否將lib項目屬性設置爲「is library」?你是否在你的主項目中包含了你的lib項目? – KOTIOS
是的,並且已經在啓動器項目 –
中添加了,同時指出它必須要求導入的類名稱是否做到這一點? – KOTIOS