0

I am trying to put a TextClock into my application to display the time formatted like so: 8:23 PM.

I set the minSdkVersion in the build.gradle file to 17 and synced the project so that I can use TextClock in my app. In the .xml file I set the TextClock id to clock. In the .java Activity file I inflated the view in the onCreate() method. I have tried invalidating/restarting caches, and cleaning/rebuilding the project and nothing has resolved the problem.

build.gradle file

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.agilysys.mobconceirge"
    minSdkVersion 17
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    android.defaultConfig.vectorDrawables.useSupportLibrary = true
}

ReservationListActivity.java file

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reservations_list);
    textClock = (TextClock) findViewById(R.id.clock);
}

activity_reservations_list.xml file

<TextClock
    android:id="@+id/clock"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:format12Hour="h:mm:ss a"
    android:textColor="@color/penRoyalBlue"
    android:textSize="20sp"/>

When I go to build the compiler is giving me the error: "cannot find symbol variable clock".

Hayes Roach
  • 121
  • 10

0 Answers0