java - Android Studio: Error: <identifier> expected error -


i'm rookie programming. i've been trying build app , been getting these errors seen in screenshot. i've tried "invalid caches/restart" didn't help. doing wrong here?

enter image description here

edit: sorry earlier ignorance. i've added code snippets.

login.java:

package com.example.ankit.mrestro;  import android.content.intent; import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.view.menu; import android.view.menuitem; import android.widget.button; import android.widget.edittext; import android.widget.textview;  public class login extends appcompatactivity implements view.onclicklistener {     button blogin;     edittext etusername, etpassword;     textview registerhere,skip;     userlocalstorage userlocalstorage;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_login);          etusername = (edittext) findviewbyid(r.id.etusername);         etpassword = (edittext) findviewbyid(r.id.etpassword);         registerhere = (textview) findviewbyid(r.id.registerhere);         skip = (textview) findviewbyid(r.id.skip);          blogin = (button) findviewbyid(r.id.blogin);         blogin.setonclicklistener(this);         registerhere.setonclicklistener(this);         skip.setonclicklistener(this);          userlocalstorage= new userlocalstorage(this);        }      @override     public void onclick(view v) {       switch (v.getid()){         case r.id.blogin:             user user= new user(null, null);             userlocalstorage.storeuserdata(user);          userlocalstorage.setuserloggedin(true);              break;          case r.id.registerhere:             startactivity(new intent(this,register.class));             break;         case r.id.skip:             startactivity(new intent(this,mainactivity.class));             break;         }     } } 

activity_login.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:layout_width="fill_parent"     android:layout_height="fill_parent"     android:gravity="center"     android:background="@drawable/screen1"     android:orientation="vertical"     tools:ignore="hardcodedtext" >      <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1.2"         android:orientation="vertical">      </linearlayout>      <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.3"         android:orientation="vertical">          <edittext             android:layout_width="350dp"             android:layout_height="35dp"             android:layout_gravity="center"             android:background="@drawable/text"             android:textcolor="#a9a9a9a9"             android:textstyle="normal"             android:textsize="20sp"             android:textalignment="center"             android:text="username"/>     </linearlayout>      <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.4"         android:orientation="vertical">          <edittext             android:layout_width="350dp"             android:layout_height="35dp"             android:layout_gravity="center"             android:background="@drawable/text"             android:textcolor="#a9a9a9a9"             android:textstyle="normal"             android:textsize="20sp"             android:textalignment="center"             android:text="password"/>     </linearlayout>     <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.8"         android:orientation="vertical">          <button             android:layout_width="@android:dimen/thumbnail_width"             android:layout_height="@android:dimen/app_icon_size"             android:layout_gravity="center"             android:background="@drawable/button"             android:textcolor="#ffffff"             android:textstyle="bold"             android:textsize="20dp"             android:text="login"/>     </linearlayout>      <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.2"         android:orientation="vertical">          <button             android:layout_width="120dp"             android:layout_height="25dp"             android:layout_gravity="center"             android:background="@null"             android:textcolor="#ffffff"             android:textstyle="bold"             android:textsize="15dp"             android:text="register"/>     </linearlayout>      <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.4"         android:orientation="vertical">          <button             android:layout_width="120dp"             android:layout_height="25dp"             android:layout_gravity="center"             android:background="@null"             android:textcolor="#ffffff"             android:textstyle="bold"             android:textsize="15dp"             android:text="skip"/>      </linearlayout>    </linearlayout> 

thanks guys!

look @ activity_login.xml ensure id's trying reference linked ui elements in layout file. seems trying link class level variable in findviewbyid() instead of linking variable id's in layout file of corresponding ui elements.

edit: none of ui elements (edittext fields, buttons, or linearlayouts) have id's associated them. can either double click elements when viewing activity_login.xml in 'desgin' view set id specific element. otherwise, can define id element in 'properties' window or explicitly write out android:id="@+id/youridhere" in 'text' view of layout file. whatever decide make id, must call in name in findviewbyid() so: findviewbyid(r.id.youridhere);.

hope helps!


Comments