Android ホームスクリーンを開発しました。コードは正しいようですが、プロジェクトを実行すると次のエラーが発生します。
java.lang.RuntimeException:
Unable to instantiate activity ComponentInfo{com.matthieu.launcher/
com.matthieu.launcher.DragableSpace}:
java.lang.InstantiationException: com.matthieu.launcher.DragableSpace
完全なログは次のとおりです: http://pastebin.com/iYtYW2W6
このコードは、Android Launcher から直接取得したものです。
DragableSpace : http://pastebin.com/jpWDtFPF
メインアクティビティ:
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DragableSpace space = new DragableSpace(this.getApplicationContext());
setContentView(space);
}
}
値フォルダー内のattr.xml :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="DragableSpace">
<attr name="default_screen" format="integer"/>
</declare-styleable>
</resources>
3 つの xml ファイルinitial_screen、left_screen、right_screenは、ID 以外はすべて同じコードです。
<LinearLayout android:id="@+id/center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
</LinearLayout>
マニフェスト:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.matthieu.launcher"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
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>
それを修正する方法はありますか?