Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 14-Feb-12 15:05pm
v2
Comments
Sergey Alexandrovich Kryukov 14-Feb-12 20:55pm    
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900