That is because your click listener ONLY exists for the dagens_button... You are using an anonymous class on dagens_button. Thus, that is the only view that will ever get the onClick event and you can take the case statement out.
Do the same thing for nyeste_button and it will work... Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Wed, Jun 20, 2012 at 10:35 AM, Lars <lars.breum...@gmail.com> wrote: > Hello out there. > > In my application I have 5 buttons, but i can only make 1 one of them > work(well i've only tried with 2 buttons =)) > Eclipse doesn't show any errors, but nothing happens when i press the > nyeste_button. > > final Button dagens_button = (Button) findViewById(R.id.dagens_button); > dagens_button.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > switch (v.getId()){ > case R.id.dagens_button: > Intent i = new Intent(BrowserActivity.this, dagensbilde.class);; > startActivity(i); > switch (v.getId()){ > case R.id.nyeste_button: > Intent i1 = new Intent(BrowserActivity.this, > nyestebilde.class);; > startActivity(i1); > break; > } > // Perform action on click > } > {; > }{; > }};;;{;;;};});}} > > > > Den torsdag den 7. juni 2012 21.21.26 UTC+2 skrev Lars: > >> Hello >> I am new at this site and new at developing. >> The first activity in my application has 5 buttons, every one of them >> should(at som point when I get it done) lead to a web page using the >> "webview" wigdet. Eclipse does'nt show any errors or mistakes in the code >> ANYWHERE. >> >> BUT, when I try to run the app on my phone it only shows my background >> color and the applications name. >> >> This is what Eclipse shows (picture is taken with my phone) in main.xml >> >> <https://lh6.googleusercontent.com/-Eh4Mstm6RTI/T9D-o7D2CsI/AAAAAAAAEdo/mNDvt-qH0k8/s1600/IMG_20120607_211404.jpg> >> This is what my phone shows: as you can see theres something wrong. but >> what? please help me. Thanks, Lars. >> >> <https://lh6.googleusercontent.com/-hF-KuNJLMk8/T9D9_s8LeXI/AAAAAAAAEdY/_iry-jMFNv4/s1600/Screenshot_2012-06-07-19-05-04.png> >> > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en