I'm doing on UDACITY the android development for begginers course and in 
one exercice we must put this code o the activity_main.xml:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    xmlns:tools="http://schemas.android.com/tools";
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.android.justjava.MainActivity">

    <TextView
        android:id="@+id/quantity"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Quantity"
        android:textAllCaps="true"/>
    <TextView
        android:id="@+id/number_quantity"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="0"
        android:textColor="#000000"
        android:textSize="16sp"
        android:paddingTop="16dp"
        android:paddingBottom="16dp"/>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ORDER"
        android:OneClick="submitOrder"

        />
</LinearLayout>











and on the MainActivity.java this code:








/**

 * Add your package below. Package name can be found in the project's 
AndroidManifest.xml file.

 * This is the package name our example uses:

 *

 * package com.example.android.justjava;

 */



import android.os.Bundle;

import android.support.v7.app.AppCompatActivity;

import android.view.View;

import android.widget.TextView;


/**

 * This app displays an order form to order coffee.

 */

public class MainActivity extends AppCompatActivity {



    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

    }



    /**

     * This method is called when the order button is clicked.

     */

    public void submitOrder(View view) {

        display(1);

    }


    /**

     * This method displays the given quantity value on the screen.

     */

    private void display(int number) {

        TextView quantityTextView = (TextView) 
findViewById(R.id.quantity_text_view);

        quantityTextView.setText("" + number);

    }

}







And on the MainActivity.java code the R is in red and i don't understand why???

I've tryed to clean the project, build the project and changing the code but i 
cannot resolve the problem.

Please HELP ME!!!!!

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/2fb7aca7-77d0-4114-b622-51847dec7e8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to