ListView の内容を TextView の配列に設定しようとしています。
私が現在持っているものでは、ここで提案されていることをしていると思いますが、Null Pointer Exception が発生します: how do I add items to listview dynamic in android
これが私が現在持っているものです:
ListView lvSuggestions = (ListView)findViewById(R.id.lvSuggestions);
ArrayAdapter<TextView> arrayAdapter = new ArrayAdapter<TextView>(this, android.R.layout.simple_list_item_1);
lvSuggestions.setAdapter(arrayAdapter);
しかし、アダプターを設定すると例外が発生します。
ArrayList に TextViews を入力してから、完全な ArrayList を使用して Adapter を作成しようとしましたが、Adaptor を設定すると同じ Null Pointer Exception が発生します。
助けてくれてありがとう