Click here to Skip to main content
Sign Up to vote bad
good
See more: Android
Hi,
         I am trying to use image view as a button. So that when the user clicks on the image i want a differenot xml file to be displayed as layout.
 
I have changed as follows..
      <xml>
      <ImageView
            android:id="@+id/telugu"
            android:layout_width="130dp"
            android:layout_height="25dp"
            android:layout_x="-34dp"
            android:layout_y="315dp"
            android:clickable="true"
            android:onClick="myClickHandler"
      <xml>
and myClickHandler is..
                           public void myClickHandler(View view) {
                                                             switch (view.getId()) {
                                                                                             case R.id.arts:
                                                                                          setContentView(R.layout.arts);
                                                                               case R.id.music:
                                                                                          setContentView(R.layout.music);
 
The problem is i am unable to go to the specific layout. It is going to the same layout no matter which image I select.
Posted 14 Feb '12 - 14:48
Edited 14 Feb '12 - 15:05

Comments
SAKryukov - 14 Feb '12 - 20:55
Code formatting is lost. Please fix it; the problem appears because you forgot to escape <> with HTML entities &lt; &gt;; also, enclose code in <pre language="xml"> tags. --SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 325
1 Mohammed Hameed 123
2 Sergey Alexandrovich Kryukov 115
3 Santhosh G_ 103
4 Ron Beyer 89
0 Sergey Alexandrovich Kryukov 8,286
1 OriginalGriff 6,561
2 CPallini 3,533
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 14 Feb 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid