Just Learning
Just Learning

Reputation: 11

How may I use one Kotlin Listview Adapter for 2 activities?

According to Android ListView Adapter multiple Activity and Can I use a single Custom Adapter for multiple activities in the same project?, it can be done. My code is as follows but it doesn't work. I can't find more recent examples anywhere.

First activity ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_item, quantity); aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //Setting the ArrayAdapter data on the Spinner spinner.setAdapter(aa);

Second activity ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_item, quantity); aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //Setting the ArrayAdapter data on the Spinner spinner2.setAdapter(aa);

                Intent intent = new Intent(FirstActivity.this, FirstCartActivity.class);
                intent.putExtra("TempListViewHolder", TempHolder);
                intent.putExtra("TempListViewHolder2", TempHolder2);
                intent.putExtra("TempListViewHolder3", TempHolder3);
                intent.putExtra("TempListViewHolder4", TempHolder4);
                intent.putExtra("TempListViewHolder5", TempHolder5);
                intent.putExtra("TempListViewHolder6", TempHolder6);
                intent.putExtra("TempListViewHolder7", TempHolder7);
                startActivity(intent);


                Intent intent = new Intent(SecondActivity.this, FirstCartActivity.class);

Upvotes: 0

Views: 10

Answers (0)

Related Questions