我正在为显示数据创建回收站视图,我希望在活动I之间传递数据。但是我在Logcat中获得了以下错误。在logcat我有:
二进制XML文件行#6:错误扩充类片段
09-26 17:18:32.535 30028-30028/? D/dalvikvm: Late-enabling CheckJNI
09-26 17:18:33.475 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
09-26 17:18:33.487 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve interface method 20343: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
09-26 17:18:33.487 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
09-26 17:18:33.487 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
09-26 17:18:33.487 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
09-26 17:18:33.487 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve interface method 20345: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
09-26 17:18:33.495 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve interface method 20349: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 478: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 500: Landroid/content/res/TypedArray;.getType (I)I
09-26 17:18:33.499 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
09-26 17:18:33.611 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.widget.FrameLayout.startActionModeForChild, referenced from method android.support.v7.widget.ActionBarContainer.startActionModeForChild
09-26 17:18:33.623 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 20823: Landroid/widget/FrameLayout;.startActionModeForChild (Landroid/view/View;Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
09-26 17:18:33.623 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6f at 0x0002
09-26 17:18:33.651 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
09-26 17:18:33.659 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 20233: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
09-26 17:18:33.659 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6f at 0x0007
09-26 17:18:33.671 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
09-26 17:18:33.671 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 292: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
09-26 17:18:33.671 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
09-26 17:18:33.687 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
09-26 17:18:33.687 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 441: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
09-26 17:18:33.719 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
09-26 17:18:33.719 30028-30028/blueappsoftware.mybakingtips I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
09-26 17:18:33.719 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve virtual method 443: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
09-26 17:18:33.719 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
09-26 17:18:33.731 30028-30028/blueappsoftware.mybakingtips E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
09-26 17:18:33.731 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve instanceof 142 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
09-26 17:18:33.731 30028-30028/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
09-26 17:18:33.863 30028-30030/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 225K, 4% free 10932K/11271K, paused 36ms+10ms, total 70ms
09-26 17:18:34.167 30028-30028/blueappsoftware.mybakingtips D/libEGL: loaded /system/lib/egl/libEGL_genymotion.so
[ 09-26 17:18:34.171 30028:30028 D/ ]
HostConnection::get() New Host Connection established 0xb7fbdd10, tid 30028
09-26 17:18:34.227 30028-30028/blueappsoftware.mybakingtips D/libEGL: loaded /system/lib/egl/libGLESv1_CM_genymotion.so
09-26 17:18:34.231 30028-30028/blueappsoftware.mybakingtips D/libEGL: loaded /system/lib/egl/libGLESv2_genymotion.so
09-26 17:18:34.351 30028-30028/blueappsoftware.mybakingtips W/EGL_genymotion: eglSurfaceAttrib not implemented
09-26 17:18:34.359 30028-30028/blueappsoftware.mybakingtips D/OpenGLRenderer: Enabling debug mode 0
09-26 17:18:34.403 30028-30028/blueappsoftware.mybakingtips D/OpenGLRenderer: TextureCache::get: create texture(0xb7fa1438): name, size, mSize = 1, 4096, 4096
09-26 17:18:35.019 30028-30057/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
09-26 17:18:35.023 30028-30057/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
09-26 17:18:35.023 30028-30057/blueappsoftware.mybakingtips I/dalvikvm: Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
09-26 17:18:35.023 30028-30057/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve static method 22790: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
09-26 17:18:35.023 30028-30057/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x71 at 0x000a
09-26 17:18:35.023 30028-30057/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
09-26 17:18:35.047 30028-30057/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
09-26 17:18:35.047 30028-30057/blueappsoftware.mybakingtips I/dalvikvm: Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
09-26 17:18:35.047 30028-30057/blueappsoftware.mybakingtips W/dalvikvm: VFY: unable to resolve static method 22789: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
09-26 17:18:35.047 30028-30057/blueappsoftware.mybakingtips D/dalvikvm: VFY: replacing opcode 0x71 at 0x000a
09-26 17:18:35.063 30028-30030/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 256K, 4% free 11076K/11463K, paused 15ms+0ms, total 34ms
09-26 17:18:36.155 30028-30028/blueappsoftware.mybakingtips E/main: retrofit response [blueappsoftware.mybakingtips.Recipe@536d1df8, blueappsoftware.mybakingtips.Recipe@536e3e04, blueappsoftware.mybakingtips.Recipe@536e74a4, blueappsoftware.mybakingtips.Recipe@536ebeb8]
09-26 17:18:36.155 30028-30028/blueappsoftware.mybakingtips E/main: name Nutella Pie serving 8
09-26 17:18:36.155 30028-30028/blueappsoftware.mybakingtips E/main: name Brownies serving 8
09-26 17:18:36.155 30028-30028/blueappsoftware.mybakingtips E/main: name Yellow Cake serving 8
09-26 17:18:36.155 30028-30028/blueappsoftware.mybakingtips E/main: name Cheesecake serving 8
09-26 17:18:36.223 30028-30030/blueappsoftware.mybakingtips D/dalvikvm: GC_CONCURRENT freed 257K, 4% free 11290K/11655K, paused 15ms+15ms, total 49ms
09-26 17:18:36.319 30028-30028/blueappsoftware.mybakingtips D/OpenGLRenderer: TextureCache::get: create texture(0xb7f802e0): name, size, mSize = 9, 33856, 37952
09-26 17:18:41.071 30028-30028/blueappsoftware.mybakingtips D/AndroidRuntime: Shutting down VM
09-26 17:18:41.095 30028-30028/blueappsoftware.mybakingtips W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa62aa288)
09-26 17:18:41.095 30028-30028/blueappsoftware.mybakingtips E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{blueappsoftware.mybakingtips/blueappsoftware.mybakingtips.SelectReceipe}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at blueappsoftware.mybakingtips.SelectReceipe.onCreate(SelectReceipe.java:22)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at blueappsoftware.mybakingtips.FragmentOne.onCreateView(FragmentOne.java:32)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:807)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1013)
at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1112)
at android.app.Activity.onCreateView(Activity.java:4664)
at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:36)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:75)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at blueappsoftware.mybakingtips.SelectReceipe.onCreate(SelectReceipe.java:22)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
09-26 17:18:43.295 30028-30028/blueappsoftware.mybakingtips I/Process: Sending signal. PID: 30028 SIG: 9
我的xml文件包含i pad size的两个片段:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/idfragmentone"
android:name="blueappsoftware.mybakingtips.FragmentOne"/>
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/idfragmentwo"
android:name="blueappsoftware.mybakingtips.Fragmentwo"/>
</LinearLayout>
此片段类包含列表视图:
package blueappsoftware.mybakingtips;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
/**
* Created by mac on 26/9/2017.
*/
public class FragmentOne extends Fragment {
ListView mainListView;
int fitempostion;
ArrayList<String>stepList=new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view= inflater.inflate(R.layout.fragmentone,container,false);
mainListView=(ListView)view.findViewById(R.id.listview);
fitempostion= ((SelectReceipe)getActivity()).getItempostion();
//((SelectReceipe)getActivity()).sListRecipe.get(fitempostion).getSteps()
for (int i=0;i< ((SelectReceipe)getActivity()).sListRecipe.get(fitempostion).getSteps().size();i++){
stepList.add (((SelectReceipe)getActivity()).sListRecipe.get(fitempostion).getSteps().get(i).toString());
Log.e("fragment One ","step i "+i+"value"+ ((SelectReceipe)getActivity()).sListRecipe.get(fitempostion).getSteps().get(i).toString());
}
ArrayAdapter <String>adapter=new ArrayAdapter<String>(inflater.getContext(),android.R.layout.simple_list_item_1,stepList);
mainListView.setAdapter(adapter);
return view;
}
}
我的XML中有什么问题?