我一直在尝试创建一个listview应用程序并按照一步一步的指示,它成功构建但是当我尝试在手机上运行它时它总是自行关闭。
我试图在这里搜索可能类似的问题,但似乎没有任何东西符合我的条件。如果我的问题结果是重复,请告诉我可能有助于我摆脱这种情况的链接。
activity_main.xml中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
item_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="30sp"
android:layout_gravity="start"
android:id="@+id/item_title"/>
</LinearLayout>
MainActivity.java
package com.tumblr.ulaaidesu.savingtracker;
import android.app.Activity;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ListView listview=(ListView)findViewById(R.id.list);
String[] listgoal = new String[] {
"Buku 1",
"Buku 2",
"Buku 3",
"Album 1",
"Album 2",
"Album 3",
"Tiket 1",
"Tiket 2",
"Tiket 3"
};
final ArrayList<String> listie = new ArrayList<String>();
for (int i = 0; i < listgoal.length; ++i) {
listie.add(listgoal[i]);
}
final StableArrayAdapter adapter = new StableArrayAdapter(this, R.layout.item_layout, listie);
listview.setAdapter(adapter);
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, final View view,
int position, long id) {
final String item = (String) parent.getItemAtPosition(position);
view.animate().setDuration(2000).alpha(0)
.withEndAction(new Runnable() {
@Override
public void run() {
listie.remove(item);
adapter.notifyDataSetChanged();
view.setAlpha(1);
}
});
}
});
}
private class StableArrayAdapter extends ArrayAdapter<String> {
HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();
public StableArrayAdapter(Context context, int textViewResourceId,
List<String> objects) {
super(context, textViewResourceId, objects);
for (int i = 0; i < objects.size(); ++i) {
mIdMap.put(objects.get(i), i);
}
}
@Override
public long getItemId(int position) {
String item = getItem(position);
return mIdMap.get(item);
}
@Override
public boolean hasStableIds() {
return true;
}
}
}
logcat的
11-08 15:13:43.237 229-229/? V/WLAN_PSA: NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
11-08 15:13:48.247 229-229/? V/WLAN_PSA: NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
11-08 15:13:53.258 229-229/? V/WLAN_PSA: NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
11-08 15:13:53.577 21535-21535/? I/chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
11-08 15:13:55.357 18351-18351/? D/AndroidRuntime: CheckJNI is OFF
11-08 15:13:55.377 18351-18351/? D/dalvikvm: Trying to load lib libjavacore.so 0x0
11-08 15:13:55.377 18351-18351/? D/dalvikvm: Added shared lib libjavacore.so 0x0
11-08 15:13:55.387 18351-18351/? D/dalvikvm: Trying to load lib libnativehelper.so 0x0
11-08 15:13:55.387 18351-18351/? D/dalvikvm: Added shared lib libnativehelper.so 0x0
11-08 15:13:55.387 18351-18351/? D/dalvikvm: No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
11-08 15:13:55.417 18351-18351/? D/dalvikvm: Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
11-08 15:13:55.657 18351-18351/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
11-08 15:13:55.677 18351-18351/? D/AndroidRuntime: Shutting down VM
11-08 15:13:55.687 18351-18355/? D/dalvikvm: GC_CONCURRENT freed 98K, 15% free 595K/696K, paused 1ms+1ms, total 7ms
11-08 15:13:58.268 229-229/? V/WLAN_PSA: NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
11-08 15:14:01.907 18381-18381/? D/AndroidRuntime: CheckJNI is OFF
11-08 15:14:01.927 18381-18381/? D/dalvikvm: Trying to load lib libjavacore.so 0x0
11-08 15:14:01.937 18381-18381/? D/dalvikvm: Added shared lib libjavacore.so 0x0
11-08 15:14:01.937 18381-18381/? D/dalvikvm: Trying to load lib libnativehelper.so 0x0
11-08 15:14:01.937 18381-18381/? D/dalvikvm: Added shared lib libnativehelper.so 0x0
11-08 15:14:01.937 18381-18381/? D/dalvikvm: No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
11-08 15:14:01.977 18381-18381/? D/dalvikvm: Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
11-08 15:14:02.197 18381-18381/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
11-08 15:14:02.207 919-7130/? I/ActivityManager: Force stopping com.tumblr.ulaaidesu.savingtracker appid=10140 user=0: from pid 18381
11-08 15:14:02.217 18381-18381/? D/AndroidRuntime: Shutting down VM
11-08 15:14:02.217 18381-18390/? D/dalvikvm: GC_CONCURRENT freed 95K, 15% free 558K/656K, paused 0ms+0ms, total 2ms
11-08 15:14:02.767 18402-18402/? D/AndroidRuntime: CheckJNI is OFF
11-08 15:14:02.787 18402-18402/? D/dalvikvm: Trying to load lib libjavacore.so 0x0
11-08 15:14:02.787 18402-18402/? D/dalvikvm: Added shared lib libjavacore.so 0x0
11-08 15:14:02.797 18402-18402/? D/dalvikvm: Trying to load lib libnativehelper.so 0x0
11-08 15:14:02.797 18402-18402/? D/dalvikvm: Added shared lib libnativehelper.so 0x0
11-08 15:14:02.797 18402-18402/? D/dalvikvm: No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
11-08 15:14:02.847 18402-18402/? D/dalvikvm: Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
11-08 15:14:03.167 18402-18402/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
11-08 15:14:03.187 919-1175/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.tumblr.ulaaidesu.savingtracker/.MainActivity} from pid 18402
11-08 15:14:03.217 18402-18402/? D/AndroidRuntime: Shutting down VM
11-08 15:14:03.217 919-1175/? I/ActivityManager: Start proc com.tumblr.ulaaidesu.savingtracker for activity com.tumblr.ulaaidesu.savingtracker/.MainActivity: pid=18418 uid=10140 gids={50140}
11-08 15:14:03.227 18402-18410/? D/dalvikvm: GC_CONCURRENT freed 98K, 15% free 592K/692K, paused 1ms+1ms, total 5ms
11-08 15:14:03.227 18418-18418/? D/dalvikvm: Late-enabling CheckJNI
11-08 15:14:03.257 18418-18418/? D/ActivityThread: handleBindApplication:com.tumblr.ulaaidesu.savingtracker
11-08 15:14:03.267 18418-18418/? D/ActivityThread: setTargetHeapUtilization:0.75
11-08 15:14:03.267 18418-18418/? D/ActivityThread: setTargetHeapMinFree:2097152
11-08 15:14:03.277 229-229/? V/WLAN_PSA: NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028]
11-08 15:14:03.377 18418-18418/? I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LNX.LA.3.5.3.4.04.04.02.113.008_msm8610_LNX.LA.3.5.3.4__release_AU ()
11-08 15:14:03.377 18418-18418/? I/Adreno-EGL: OpenGL ES Shader Compiler Version: E031.24.00.14
11-08 15:14:03.377 18418-18418/? I/Adreno-EGL: Build Date: 07/24/14 Thu
11-08 15:14:03.377 18418-18418/? I/Adreno-EGL: Local Branch: mybranch3933040
11-08 15:14:03.377 18418-18418/? I/Adreno-EGL: Remote Branch: quic/LNX.LA.3.5.3
11-08 15:14:03.377 18418-18418/? I/Adreno-EGL: Local Patches: NONE
11-08 15:14:03.377 18418-18418/? I/Adreno-EGL: Reconstruct Branch: AU_LINUX_ANDROID_LNX.LA.3.5.3.4.04.04.02.113.008 + NOTHING
11-08 15:14:03.417 18418-18418/? D/OpenGLRenderer: Enabling debug mode 0
11-08 15:14:03.427 18418-18418/? E/ArrayAdapter: You must supply a resource ID for a TextView
11-08 15:14:03.427 18418-18418/? D/AndroidRuntime: Shutting down VM
11-08 15:14:03.427 18418-18418/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41c0fd58)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: FATAL EXCEPTION: main
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: Process: com.tumblr.ulaaidesu.savingtracker, PID: 18418
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:386)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.AbsListView.obtainView(AbsListView.java:2263)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.makeAndAddView(ListView.java:1790)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.fillDown(ListView.java:691)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.fillFromTop(ListView.java:752)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.layoutChildren(ListView.java:1630)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.AbsListView.onLayout(AbsListView.java:2091)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:574)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:544)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:733)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5118)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:780)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: Caused by: java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:379)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.AbsListView.obtainView(AbsListView.java:2263)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.makeAndAddView(ListView.java:1790)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.fillDown(ListView.java:691)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.fillFromTop(ListView.java:752)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.ListView.layoutChildren(ListView.java:1630)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.AbsListView.onLayout(AbsListView.java:2091)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.View.layout(View.java:14838)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:4631)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:574)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:544)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:733)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5118)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:780)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
11-08 15:14:03.427 18418-18418/? E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
11-08 15:14:03.437 18418-18418/? I/Process: Sending signal. PID: 18418 SIG: 9
11-08 15:14:03.437 919-1203/? W/ActivityManager: Force finishing activity com.tumblr.ulaaidesu.savingtracker/.MainActivity
11-08 15:14:03.447 17936-17936/? D/AutotriggerReceiver: [onReceive] Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 cmp=com.qualcomm.logkit/.autotrigger.AutotriggerReceiver (has extras) }
11-08 15:14:03.447 17936-17936/? D/AutotriggerReceiver: [onReceive] android.intent.action.DROPBOX_ENTRY_ADDED: data_app_crash
11-08 15:14:03.457 919-2897/? I/ActivityManager: Process com.tumblr.ulaaidesu.savingtracker (pid 18418) has died.
11-08 15:14:03.457 919-2895/? I/WindowState: WIN DEATH: Window{42adec88 u0 com.tumblr.ulaaidesu.savingtracker/com.tumblr.ulaaidesu.savingtracker.MainActivity}
11-08 15:14:07.878 919-953/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1132 com.android.internal.policy.impl.PhoneWindowManager.interceptKeyBeforeQueueing:4144 com.android.server.wm.InputMonitor.interceptKeyBeforeQueueing:357 com.android.server.input.InputManagerService.interceptKeyBeforeQueueing:1343 dalvik.system.NativeStart.run:-2
11-08 15:14:07.878 919-919/? V/KeyguardServiceDelegate: onScreenTurnedOn(showListener = com.android.internal.policy.impl.PhoneWindowManager$21@434a8640)
11-08 15:14:07.878 919-953/? I/PowerManagerService: Waking up from sleep...
11-08 15:14:07.898 19313-19313/? D/KeyguardHostView: screen on, mPassword:null
11-08 15:14:07.898 919-1518/? I/QCOM PowerHAL: Got set_interactive hint
11-08 15:14:07.908 216-216/? D/SurfaceFlinger: Screen acquired, type=0 flinger=0xb7bb54e0
11-08 15:14:07.908 216-216/? D/qdhwcomposer: hwc_blank: Unblanking display: 0
11-08 15:14:07.918 32665-32665/? D/wpa_supplicant: RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
11-08 15:14:07.918 32665-32665/? D/wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
11-08 15:14:07.937 32665-32665/? D/wpa_supplicant: nl80211: survey data missing!
11-08 15:14:07.957 219-945/? V/SRS_Proc: ParamSet string: screen_state=on
11-08 15:14:07.957 219-945/? D/audio_hw_primary: adev_set_parameters: enter: screen_state=on
11-08 15:14:07.957 219-945/? D/audio_hw_extn: audio_extn_set_anc_parameters: anc_enabled:0
11-08 15:14:07.957 219-945/? E/audio_a2dp_hw: adev_set_parameters: ERROR: set param called even when stream out is null
11-08 15:14:07.957 32665-32665/? D/wpa_supplicant: RX ctrl_iface - hexdump(len=23): 44 52 49 56 45 52 20 53 45 54 53 55 53 50 45 4e 44 4d 4f 44 45 20 30
感谢您的帮助。
答案 0 :(得分:0)
适配器需要TextView来放置数组条目,它找不到任何Container内的TextView,例如您在item_layout.xml
中使用的LinearLayout。
要解决您的问题,您可以使用以下解决方案之一:
您可以使用标准ArrayAdapter并使用适配器提供布局名称和textview ID:
arrayAdapter = new ArrayAdapter(this,R.layout.item_layout,R.id.item_title,myArray);
或者您可以在item_layout.xml文件中将TextView作为主视图提供。