Android Forums

Go Back   These FORUMS ARE DISABLED!! OUR NEW FORUMS ARE AT http://androidforum.com/ > Android Coders > Android Development, Answers, Tutorials, and Code Snippets
Connect with Facebook

Click Here To Register!
 
 
LinkBack Thread Tools Display Modes
Old 03-31-2009, 07:34 AM   #1
Junior Member
 
Join Date: Feb 2009
Posts: 10
Friends: 0
View droidan's Profile   View droidan's Photo Album   View droidan's Blog   View Social Groups
I started out with the thought that I could have an ImageView and make it tappable and got nowhere with it.

I then found ImageButton which supposedly is the way to go (please correct)

I then found how to turn off the horrid border with android:background="@null"

But please oh please how on earth do you obtain and process the tap/click whatever terminology to use?

I tried this:

java Code:
  1. public class TheApp extends Activity {
  2.    
  3.     Intent i;
  4.    
  5.     /** Called when the activity is first created. */
  6.     @Override
  7.     public void onCreate(Bundle savedInstanceState) {
  8.         super.onCreate(savedInstanceState);
  9.         setContentView(R.layout.main);
  10.        
  11.         ImageButton slide = (ImageButton) this.findViewById(R.id.drapper );
  12.          
  13.         slide.setOnClickListener(new Button.OnClickListener()
  14.         {
  15.             public void onClick(View view)
  16.             {
  17.                 showSlide();
  18.             }
  19.         });
  20.        
  21.     }
  22.    
  23.     private void showSlide() {
  24.        
  25.         Log.d("show me", "the money");
  26.        
  27.     }
  28. }
The simulator fails to load program with a force quit message!

Then I try this:

java Code:
  1. public class TheApp extends Activity implements View.OnClickListener {
  2.    
  3.     Intent i;
  4.    
  5.     /** Called when the activity is first created. */
  6.     @Override
  7.     public void onCreate(Bundle savedInstanceState) {
  8.         super.onCreate(savedInstanceState);
  9.         setContentView(R.layout.main);
  10.        
  11.         ImageButton slide = (ImageButton) this.findViewById(R.id.drapper );
  12.          
  13.         slide.setOnClickListener(this);
  14.        
  15.     }
  16.    
  17.    
  18.  public void onClick(View v) {
  19.        
  20.         Intent i;
  21.        
  22.         switch (v.getId()) {
  23.                        
  24.             case R.id.drapper:
  25.                 i = new Intent(this, Drapper.class);
  26.                 startActivity(i);
  27.                 break;
  28.  
  29.         }
  30.     }
  31.  
  32.    
  33. }
I have spend ages trudging the web trying to find the answer and am lost!

droidan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
Old 04-05-2009, 09:23 AM   #2
Junior Member
 
Join Date: Feb 2009
Posts: 10
Friends: 0
View droidan's Profile   View droidan's Photo Album   View droidan's Blog   View Social Groups
see my post, that should appear after moderation re how to do this
droidan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
 

Thread Tools
Display Modes




Unlocked G1 Phones | Buy T-Mobile G1 | Google Phone

All times are GMT -6. The time now is 03:59 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright (c) 2012 TalkAndroid.com. All rights reserved.