In my Android Application, I want to change this method to static, however when I add 'static' to the method signature, my IDE tells me that a non-static context cannot be referenced from a static context (on the findViewByID(R.id.listView)
.
public void populateListView(ArrayList<Income> incomeArray) {
ArrayList<Income> array = incomeArray;
ArrayAdapter<Income> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, array);
ListView listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);
How could I make this method static?