0
I would like to call a Manactivity for each object of the listview, without passing anything to the new one because I will create the content of the separate Manactivitys. However as this the code lowers, any item I click, calls the same Manactivity. I want to call Manactivity1, 2 and Tc for each object. package com.example.listview;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.telecom.Call;
import android.view.View;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import javax.crypto.AEADBadTagException;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView lista = (ListView) findViewById(R.id.lvEscolas);
final ArrayList <Escola> escolas = adicionarEscolas();
ArrayAdapter adapter = new EscolaAdapter(this, escolas);
lista.setAdapter(adapter);
lista.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
//intent.putExtra("nome", escolas.get(i).getNome());
startActivity(intent);