I have a listView with two elements in it, 2 elements - “seconds” and “minutes”. When I click on “seconds”, I would like alertDialogBox to open en show 5,10,15, ... seconds. Same thing when I press the minutes
Something like that:

But I had problems with its implementation, because I do not understand very well how it works. Here is the code I have:
import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class SettingsActivity extends Activity { ListView listView = (ListView) findViewById(R.id.settingsList); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); String[] values = new String[] { "Seconds", "Minutes" };
source share