Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 2nd, 2012, 08:00 AM
C0nvert C0nvert is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 18 C0nvert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 24 m 17 sec
Reputation Power: 0
Android click & longclick

I keep getting an error on the onLongClick part of this function. I want the click to take the user to phone dialer (this works), but when adding the onLongClick to go to the dialer settings activity I am getting errors. Ive tried with a public void and public boolean, but eclipse still has error, help appreciated.

Code:
 
        Button button1 = (Button) findViewById(R.id.button1);
          button1.setText(phonelbl[0]);

          button1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
            	launchDialer(phone[1]);
            }
          });
         // button1.setLongClickable(true); 
          
          button1.setOnLongClickListener(new OnLongClickListener() {
              @Override
              public boolean onLongClick(View v) {
              //public void onLongClick(View v) {            	  
             	 Intent i = new Intent(MainActivity.this, AddDiner.class);
             	 startActivity(i);             
              }
          });


I fixed it. I needed return true; in the onLongClick function

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingMobile Programming > Android click & longclick

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap