2

I have a button that when pressed, will call the company. Now, I was doing some research and found that there is a way to include a context menu. I really like the context menu because it gives you so many options.

Do you think it would be a waste of code to set a context menu for a click of the button that when pressed will open up the options to add contact, call contact, sms contact, etc.? Is it necessary?

I did come across these: Android opening context menu after button click http://developer.android.com/guide/practices/ui_guidelines/menu_design.html#tour_of_the_menus

Community
  • 1
  • 1
MCarter
  • 53
  • 2
  • 9

2 Answers2

0

It would be nice to provide a big main button to call the number, and some additional mechanism, let's say a smaller + button to do more stuff with as you sugggested. Also a long click could be considered a right user interaction to provide with more features.

Just a user feeling...

Snicolas
  • 37,840
  • 15
  • 114
  • 173
0

I think it would be a good feature to include. Thats what context menu is there for, to give more options. I think it would be good to give the user more options when the button is clicked. Well it makes more since anyway.

Heres how you would get the long click

Button downSelected = (Button) findViewById(R.id.downSelected);
    downSelected.setOnLongClickListener(new OnLongClickListener() { 
    @Override
    public boolean onLongClick(View v) {
        // TODO Auto-generated method stub
        return true;
    }
});

EDIT:

If you just want one click on the button just register its click listener like this..

downSelected.setOnClickListener(new View.OnClickListener() {
         public void onClick(View v) {
             // Perform action on click
         }
     });
 }
coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118
  • Hmm. thank you for your input. Is there any documentation or advice you can help me start getting on the ball? thanks. ;) – MCarter Jan 05 '12 at 21:13
  • http://stackoverflow.com/questions/4402740/android-long-click-on-a-button-perform-actions – Snicolas Jan 05 '12 at 21:17
  • As far making a context menu? Sure.. Perfect guide here http://developer.android.com/guide/topics/ui/menus.html – coder_For_Life22 Jan 05 '12 at 21:17
  • Okay, I just added that code to my app and it only brings up the longclicklistener...is there a way to have both methods? one click will bring up the call and the long click will bring up the context? – MCarter Jan 05 '12 at 21:22
  • callUs.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View v) { // TODO Auto-generated method stub String phoneNumber = "tel:+1800-210-9821"; Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(phoneNumber)); startActivity(callIntent); return true; } }); – MCarter Jan 05 '12 at 21:24