显示片段listView中的字符串列表

时间:2017-04-03 19:31:43

标签: java android xml

我想在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;
    }
}

并且继承了XML文件

<?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"
    />

需要有关此问题的帮助

LOg Cat

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

0 个答案:

没有答案