Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在片段列表视图中显示字符串列表_Java_Android_Xml - Fatal编程技术网

Java 在片段列表视图中显示字符串列表

Java 在片段列表视图中显示字符串列表,java,android,xml,Java,Android,Xml,我想在一个片段的ListView中显示一个字符串列表,我的问题是,只有当我设置适配器时,它才会在打开时崩溃 public class MessengerUtil extends Content { private final static String[] CONTENT ={"Joe", "Dv", "Nola", "Jimmy"}; public MessengerUtil(LayoutInflater inflater, ViewGroup container) {

我想在一个片段的ListView中显示一个字符串列表,我的问题是,只有当我设置适配器时,它才会在打开时崩溃

public class MessengerUtil extends Content
{
    private final static String[] CONTENT ={"Joe", "Dv", "Nola", "Jimmy"};
    public MessengerUtil(LayoutInflater inflater, ViewGroup container) {
        super(inflater, container);
    }

    @Override
    public View displayContent() {
        View view = inflater.inflate(R.layout.messenger_frag, container, false);
        ArrayAdapter<String> adapterA = new ArrayAdapter<String>(HomeActivity.getInstance().getApplicationContext(),R.layout.messenger_frag,CONTENT);
        ListView lv = (ListView) view;
        lv.setAdapter(adapterA);
        return view;
    }
}

您可以发布崩溃吗?添加到末尾的日志Cat不确定这是否会解决您的问题,但您没有将
ListView
设置为xml中声明的
ListView
。这应该类似于
ListView lv=(ListView)view.findViewById(R.id.MessagesList)
。他在这行中这样做:''ListView lv=(ListView)view;因为整个视图是ListView。我想您需要将方向属性设置为ListViewNope同样的问题,我甚至将上下文更改为视图上下文,但仍然没有任何更改
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="wrap_content"
    android:id="@+id/MessagesList"
    />
4-03 21:23:43.636 20630-20630/? I/art: Late-enabling -Xcheck:jni
04-03 21:23:43.825 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.120 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.189 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.252 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.321 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.382 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.458 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.520 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.582 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.646 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.708 20630-20630/com.example.devandrin.myapplication W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.devandrin.myapplication-1/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.devandrin.myapplication-1@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
04-03 21:23:44.710 20630-20630/com.example.devandrin.myapplication W/System: ClassLoader referenced unknown path: /data/app/com.example.devandrin.myapplication-1/lib/arm64
04-03 21:23:44.717 20630-20630/com.example.devandrin.myapplication I/InstantRun: Starting Instant Run Server for com.example.devandrin.myapplication
04-03 21:23:48.450 20630-20630/com.example.devandrin.myapplication W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
04-03 21:23:49.095 20630-20630/com.example.devandrin.myapplication I/HwSecImmHelper: mSecurityInputMethodService is null
04-03 21:23:49.107 20630-20630/com.example.devandrin.myapplication E/HAL: load: id=gralloc != hmi->id=gralloc
04-03 21:23:49.228 20630-20826/com.example.devandrin.myapplication E/HAL: load: id=gralloc != hmi->id=gralloc
04-03 21:23:49.228 20630-20826/com.example.devandrin.myapplication I/OpenGLRenderer: Initialized EGL, version 1.4
04-03 21:23:49.233 20630-20826/com.example.devandrin.myapplication W/OpenGLRenderer: load: so=/system/lib64/libhwuibp.so
                                                                                     dlopen failed: library "/system/lib64/libhwuibp.so" not found
04-03 21:23:49.233 20630-20826/com.example.devandrin.myapplication W/OpenGLRenderer: Initialize Binary Program Cache: Load Failed
04-03 21:23:49.234 20630-20826/com.example.devandrin.myapplication E/HAL: load: id=gralloc != hmi->id=gralloc
04-03 21:23:49.267 20630-20630/com.example.devandrin.myapplication E/ArrayAdapter: You must supply a resource ID for a TextView
04-03 21:23:49.590 20630-20630/com.example.devandrin.myapplication I/Process: Sending signal. PID: 20630 SIG: 9