On top of all that has been said before, the error message is actually correct. the IF statement needs an equality operator ( == ) , not an assignment operator ( = ) .
On Tuesday, August 21, 2012 5:34:38 PM UTC-4, Waheed Rafiq wrote: > thank you both for guiding me in a straight path with regards to xml and > java , I was reading android online tutorial , I guess i jump into the > deep end of newbie user section , > On Aug 21, 2012 10:22 PM, "Lew" <lewb...@gmail.com <javascript:>> wrote: > >> As Kristopher said, Java source is in "*.java" files and XML is in >> "*.xml" files. >> >> Also, Java follows Java syntax: >> >> package com.foo.bar; >> >> public class FooBar >> { >> public static void main(String [] args) >> { >> // ... etc. >> } >> } >> >> XML follows XML syntax: >> >> <rootTag> >> <someOtherTag someAttribute="value"> >> <yetAnotherTag>content</yetAnotherTag> >> <moreTag id="more" value="barfoo" /> >> </someOtherTag> >> </rootTag> >> >> Now, when someone new to Java and XML runs into a question, it is good >> to search through the documentation for Java and for XML: >> >> <http://docs.oracle.com/javase/> >> <http://www.w3schools.com/xml/default.asp> >> >> Read and study the tutorials, etc. >> >> -- >> Lew >> >> Waheed Rafiq wrote: >>> >>> you defo got one thing right " I am confused" -:) I actually thought I >>> was writing code in java ? so this now begs the question where do I write >>> the code if not in MyFirstApp.main >>> >>> I am new to Java and XML >>> >>> thanks for your prompt reply >>> Kristopher Micinsk wrote: >>> >>>> You seem to be quite confused... You can't write an if statement >>>> inside XML, it's not interactive (computation), it's just static XML. >>>> >>>> What you need to do is put that in your java code, >>>> >>>> Waheed Rafiq wrote: >>>> > Hi guys , I am new to android development >>>> > >>>> > for sometime I have try to resolve the if statement issue within my >>>> code >>>> > but can't seem to understand why it does not work >>>> > >>>> > here is my code that I was learning from online tutorial >>>> > >>>> > <RelativeLayout xmlns:android="http://schemas.** >>>> android.com/apk/res/android<http://schemas.android.com/apk/res/android> >>>> " >>>> > >>>> > xmlns:tools="http://schemas.**android.com/tools<http://schemas.android.com/tools> >>>> " >>>> > android:layout_width="match_**parent" >>>> > android:layout_height="match_**parent" > >>>> > >>>> > <TextView >>>> > android:id="@+id/textView1" >>>> >>> >> . . . [ snip ] . . . >> >> >>> > android:text="Edit me" // on this line I name the button >>>> Edit Me >>>> > >>>> > if(android.text="Hussian Waheed") android.text="Change Me"; >>>> // on >>>> > this line I am trying to say if the button is "Edit Me" then change >>>> this to >>>> > "Change Me" >>>> > >>>> > >>>> > all I get is a error stating my if statment requires a equal , I just >>>> don't >>>> > understand it. really would like someone to give me a better example >>>> of how >>>> > to change a button name to different button name. >>>> > >>>> >>> >> >>> > /> >>>> > >>>> > </RelativeLayout> >>>> >>> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to >> android-d...@googlegroups.com<javascript:> >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com <javascript:> >> 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