このアクティビティは機能するものと重複しています。私は私の誤りを見つけることができません。私はまた、成功せずに広範囲に調査しました。これは私の最初のアプリであり、どんな助けも大歓迎です。エラー主な活動でリストビューセットアダプタ で発生Androidが起動できませんlistviewでnullポインタの例外が発生しましたsetadapter
package com.example.jaclen.queensdreambook;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class bMainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_b_main);
ListView listViewbwlo = (ListView) findViewById(R.id.ListViewbwlo);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.bw, android.R.layout.simple_list_item_1);
listViewbwlo.setAdapter(adapter);
}
}
レイアウトXML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#DAA520">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listViewbwlo"
android:divider="#000000"
android:dividerHeight="@dimen/activity_vertical_margin">
</ListView>
</LinearLayout>
マニフェスト アンドロイド:versionCode = "1" アンドロイド:versionName = "1.0">
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".QueenActivityMainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ainfoMainActivity"
android:label="Queens Dream Book"
android:parentActivityName=".QueenActivityMainActivity" >
<intent-filter>
<action android:name="com.example.jaclen.queensdreambook.ainfoMainActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.jaclen.queensdreambook.QueenActivityMainActivity" />
</activity>
<activity
android:name=".bMainActivity"
android:label="@string/QueensDreamBook"
android:parentActivityName=".QueenActivityMainActivity" >
<intent-filter>
<action android:name="com.example.jaclen.queensdreambook.bMainActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.jaclen.queensdreambook.QueenActivityMainActivity" />
</activity>
logcat
03-24 15:21:03.080 12337-12337/com.example.jaclen.queensdreambook I/System.out﹕ Sending WAIT chunk
03-24 15:21:03.280 12337-12337/com.example.jaclen.queensdreambook I/System.out﹕ Debugger has connected
03-24 15:21:03.280 12337-12337/com.example.jaclen.queensdreambook I/System.out﹕ Debugger has connected
1:03.480 12337-12337/com.example.jaclen.queensdreambook I/System.out﹕ `enter code here`waiting for debugger to settle...
1:03.690 12337-12337/com.example.jaclen.queensdreambook I/System.out﹕ waiting for debugger to settle...
03-24 15:21:04.892 12337-12337/com.example.jaclen.queensdreambook I/System.out﹕ debugger has settled (1441)
4 15:21:06.073 12337-12337/com.example.jaclen.queensdreambook I/Adreno200-EGLSUB﹕ <ConfigWindowMatch:2218>: Format RGBA_8888.
12337/com.example.jaclen.queensdreambook D/memalloc﹕ ion: Mapped buffer base:0x5bd9c000 size:1536000 offset:0 fd:58
03-24 15:21:06.103 12337-12337/com.example.jaclen.queensdreambook E/﹕ Can't open file for reading
03-24 15:21:06.113 12337-12337/com.example.jaclen.queensdreambook E/﹕ Can't open file for reading
03-24 15:21:06.964 12337-12337/com.example.jaclen.queensdreambook D/memalloc﹕ ion: Mapped buffer base:0x5c28d000 size:1536000 offset:0 fd:62
03-24 15:21:07.014 12337-12337/com.example.jaclen.queensdreambook D/memalloc﹕ ion: Mapped buffer base:0x5c414000 size:1536000 offset:0 fd:65
03-24 15:28:27.544 12337-12337/com.example.jaclen.queensdreambook W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40d01210)
03-24 15:28:27.564 12337-12337/com.example.jaclen.queensdreambook E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jaclen.queensdreambook/com.example.jaclen.queensdreambook.bMainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4428)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.jaclen.queensdreambook.bMainActivity.onCreate(bMainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4428)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
xmlのあなたのIDが 'android:id =" @ + id/listViewbwlo "' – Raghunandan
の間にあなたは 'R.id.ListViewbwlo'を持っていますが、それはどのようにしてコンパイルされましたか?大文字の 'L' - ListViewbwloのビューがいくつかあります。 –