0
And everyone, I’m starting to program with Android Studio, but I have a problem. I created a class in the same mainactivity package, and I was able to instill that class, but I can’t use its Methods. Mainactivity is not recognizing these methods.
Follows Code of the Class:
package com.example.myapplication;
public class Casa {
public void AbrirPorta(){
System.out.println("Porta Aberta");
}
}
Follow Mainactivity Code:
package com.example.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Casa C = new Casa();
}
Good night, Wesley! Where you call the method?
– Ivan Silva
Yes Ivan, right after the instance, I call the class, but it does not suggest any option of methods. And if I type the method name, it is not recognized
– Wesley Carvalho