Click here to Skip to main content
12,635,139 members (23,863 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Mobile 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 15:48pm
Updated 14-Feb-12 16:05pm
v2
Comments
SAKryukov 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 14 Feb 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100