android - Build in error in MainActivity.java file -


package com.example.buttontest;  import android.os.bundle; import android.app.activity; import android.view.menu;  public class mainactivity extends activity{      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);     }      public void dosomething(view v) {         log.d("krishna","button clicked");     } } 

when writing method public void dosomething(view v) { log.d("krishna","button clicked"); }

in above method 2 errors coming

  1. view cannot resolved type
  2. log cannot resolved.

please tell how resolve build error

do 1 click following keys

ctrl + shift + o

it automatically import usefull class or package ,

automatically remove use less import

or specific problem

you can follow @codemagic's answer; manually adding imports


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -