Calling ACTION_CALL intent from arraylist


New Member
I created araylist and stored list of some most important services in small town ,and some random img of phone.The idea was that when user press it it would via intent call that number.But the problem is i don't know where to store phone numbers.I have vague idea how to call that intent but it's all fell apart because i have no idea from where to call phone numbers,where to store it....All phone numbers are different so that add to complexity...

JAVA code
package com.example.korisnik.indjijavodic;

    import android.os.Bundle;
    import android.widget.ListView;

    import java.util.ArrayList;

    public class Dobrodosli extends AppCompatActivity {
        protected void onCreate(Bundle savedInstanceState) {

            ArrayList<AndroidDobrodosli> androidDobrodosli = new ArrayList<>();
            androidDobrodosli.add(new AndroidDobrodosli("Taksi stanica"));
            androidDobrodosli.add(new AndroidDobrodosli("Autobuska stanica"));
            androidDobrodosli.add(new AndroidDobrodosli("Zeleznicka stanica"));
            androidDobrodosli.add(new AndroidDobrodosli("Turisticka agencija grada"));
            androidDobrodosli.add(new AndroidDobrodosli("Policija"));
            androidDobrodosli.add(new AndroidDobrodosli("Hitna pomoc"));

            DobrodosliAdapter dobrodosliAdapter = new DobrodosliAdapter(this,androidDobrodosli);
            ListView listView = findViewById(;


     public class AndroidDobrodosli {
        private String mInfo;

        public int getmBrTelefona() {
            return mBrTelefona;

        private int mBrTelefona;
        public String getmInfo() {
            return mInfo;

        public AndroidDobrodosli(String mInfo,int mBrTelefona) {
            this.mInfo = mInfo;
            this.mBrTelefona = mBrTelefona;

    public class DobrodosliAdapter extends ArrayAdapter<AndroidDobrodosli> {

    public DobrodosliAdapter(Dobrodosli dobrodosli, ArrayList<AndroidDobrodosli> androidDobrodosli) {
        super(dobrodosli, 0, androidDobrodosli);

    public View getView(int position, View convertView, ViewGroup parent) {
        View listView = convertView;
        if (listView == null) {
            listView = LayoutInflater.from(getContext()).inflate(R.layout.dobrodosli, parent, false);

        AndroidDobrodosli dobrodosli = getItem(position);
        TextView brojTelefona = (TextView) listView.findViewById(;
        return listView;
And please don't tell me about SQL and storing's still beyond me


Thành viên BQT
Using your code...

When setting up your arrayList change your adds to something like this to include the number..

androidDobrodosli.add(new AndroidDobrodosli("Taksi stanica","01234567890"));
When you set up your onClick you will have the postion so you can do something like this to setup the intent...
Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:"+androidDobrodsli.get(position).getmBrTelefona()); startActivity(intent);

Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.