0

i'm using a listview. i made it customized. i thing i couldn't figure it out was intent.call action. i try to make a kind of phone book so users can call from listview.

ImageButton call = (ImageButton) customView.findViewById(R.id.call);
    call.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "Your Phone_number"));
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        }
    });

So i made some research to solve it. there was an sentece says custom adapter doesn't act like activity or something. I will appreciate any help.

error: cannot find symbol method startActivity(Intent)

Update:
i couldn't make call. instead of it i start a new activity such as call.java and send phone data while intent new activity then i made the call on create.

  • are you try to call startActivity(intent); from an adapter class? startActivity(intent); is a method of activity class. you should call it in a activity class or through Context in a Adapter. – user7676575 Apr 23 '17 at 12:27
  • i don't understand i'm a beginner do you have an example? –  Apr 23 '17 at 12:30
  • http://stackoverflow.com/a/4197364/7079340 this is what the answer above me was saying – yanivtwin Apr 23 '17 at 13:06
  • Possible duplicate of [Start activity from adapter don't work with SwipeListView library](http://stackoverflow.com/questions/16045006/start-activity-from-adapter-dont-work-with-swipelistview-library) – yanivtwin Apr 23 '17 at 13:07

0 Answers0