I am new to android dev and started learning from udacity course but the java code is not running It is showing errors(picture below). I am new at stack overflow too sorry I don't know how to properly post a question.
the java program(image to know the errors)
https://drive.google.com/file/d/1D-OSZX2oxuRWZD_Yb8x4WWUBhMykWQKq/view?usp=sharing
package com.example.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);
}
}`
the XML code`
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quantity:"
android:padding="15dp"
/>
<TextView
android:id="@+id/quantity_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:layout_below="@id/quantity"
android:paddingLeft="30dp"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:layout_below="@id/quantity_text_view"
android:onClick="submitOrder"
android:text="Order"/>
</RelativeLayout>`
v7 is no longer supported. Instead of v7 use androidx packages.
import androidx.appcompat.app.AppCompatActivity;