【发布时间】:2011-12-31 04:22:06
【问题描述】:
我正在尝试来自this blog 的应用程序。在扩展FragmentActivity 时,出现以下错误:
`FragmentActivity` was not able to resolve.
我是否缺少任何图书馆或其他任何东西?
我的代码:
public class Testing_newActivity extends FragmentActivity { // here the FragmentActivity getting error package not found for import
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
if (getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE) {
// If the screen is now in landscape mode, we can show the
// dialog in-line so we don't need this activity.
finish();
return;
}
if (savedInstanceState == null) {
// During initial setup, plug in the details fragment.
DetailsFragment details = new DetailsFragment();
details.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction().add(
android.R.id.content, details).commit();
}
}
}
安卓清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.searce.testingnew"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="11" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" >
<activity android:label="@string/app_name" android:name=".Testing_newActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
【问题讨论】:
-
检查你的导入并确保所有需要的都在那里。 (如果您发布一些代码/错误日志/其他内容会更容易提供帮助)。
标签: android android-fragmentactivity