余分な文字列を取得したいのですが、どこに問題があるのか わからないというエラーが表示されます。
エクストラを入れる方法は次のとおりです。
Intent i = new Intent(Hoteli.this, ListingDetails.class);
i.putExtra(hoteli.get(position).getImage(), "listing_image");
そして、エクストラを取得する方法:
Bundle extras = getIntent().getExtras();
String imgURL=extras.getString("listing_image");
Log.v("--", imgURL);
そして、ここに私のLogCat出力があります:
06-02 13:51:27.561: E/AndroidRuntime(535): FATAL EXCEPTION: main
06-02 13:51:27.561: E/AndroidRuntime(535): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.biznismap.com/com.biznismap.com.activities.ListingDetails}: java.lang.NullPointerException: println needs a message
06-02 13:51:27.561: E/AndroidRuntime(535): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.os.Looper.loop(Looper.java:123)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-02 13:51:27.561: E/AndroidRuntime(535): at java.lang.reflect.Method.invokeNative(Native Method)
06-02 13:51:27.561: E/AndroidRuntime(535): at java.lang.reflect.Method.invoke(Method.java:521)
06-02 13:51:27.561: E/AndroidRuntime(535): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-02 13:51:27.561: E/AndroidRuntime(535): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-02 13:51:27.561: E/AndroidRuntime(535): at dalvik.system.NativeStart.main(Native Method)
06-02 13:51:27.561: E/AndroidRuntime(535): Caused by: java.lang.NullPointerException: println needs a message
06-02 13:51:27.561: E/AndroidRuntime(535): at android.util.Log.println_native(Native Method)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.util.Log.v(Log.java:101)
06-02 13:51:27.561: E/AndroidRuntime(535): at com.biznismap.com.activities.ListingDetails.getExtras(ListingDetails.java:34)
06-02 13:51:27.561: E/AndroidRuntime(535): at com.biznismap.com.activities.ListingDetails.init(ListingDetails.java:51)
06-02 13:51:27.561: E/AndroidRuntime(535): at com.biznismap.com.activities.ListingDetails.onCreate(ListingDetails.java:28)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-02 13:51:27.561: E/AndroidRuntime(535): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-02 13:51:27.561: E/AndroidRuntime(535): ... 11 more