Tuesday, August 21, 2012

Re: [android-developers] Issue with the basic if statement

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

On Aug 21, 2012 9:46 PM, "Kristopher Micinski" <krismicinski@gmail.com> 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,

kris

On Tue, Aug 21, 2012 at 4:40 PM, Waheed Rafiq <wrafiq@gmail.com> 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"
>
>     xmlns:tools="http://schemas.android.com/tools"
>
>     android:layout_width="match_parent"
>
>     android:layout_height="match_parent" >
>
>
>     <TextView
>
>         android:id="@+id/textView1"
>
>         android:layout_width="wrap_content"
>
>         android:layout_height="wrap_content"
>
>         android:layout_centerHorizontal="true"
>
>         android:layout_centerVertical="true"
>
>         android:padding="@dimen/padding_medium"
>
>         android:text="@string/hello_world"
>
>         tools:context=".MainActivity" />
>
>
>     <Button
>
>         android:id="@+id/button1"
>
>         android:layout_width="wrap_content"
>
>         android:layout_height="wrap_content"
>
>         android:layout_below="@+id/textView1"
>
>         android:layout_centerHorizontal="true"
>
>         android:layout_marginTop="59dp"
>
>         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.
>
>
> thanks
>
>
>
>
>
>
>        />
>
>
>
>
>
> </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-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment