Good afternoon, I'm having an error in Android Studio and I can not fix it.
When I opened my project several messages of type cannot resolve the symbol
and red appeared, as it is in the image.
Can someone help me, please? Such as my MainActivity.
public class MainActivity extends AppCompatActivity {
private static final String BASE_URL = "http://192.168.1.8:8080/gms/webresources/usuario/";
private static final Gson g = new GsonBuilder().registerTypeAdapter(usuario.class, new dec()).create();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*List<usuario.usuarioData> list = bd.buscar();
for(int i = 0; i < list.size(); i++){
System.out.println("AQUI" + list.get(i));
}*/
}
public void entrarSistema(View view) {
final db_funcao bd = new db_funcao(this);
usuarioDAO dao = new usuarioDAO();
final EditText login = (EditText) findViewById(R.id.usuario);
EditText senha = (EditText) findViewById(R.id.senha);
//VERIFICA SE OS EDITTEXT SÃO VAZIOS
if (login.getText().length() == 0) {
login.setError("Campo vazio");
} else {
if (senha.getText().length() == 0) {
senha.setError("Campo vazio");
} else {
if (senha.getText().length() < 6) {
senha.setError("Senha incorreta");
} else {
Retrofit retrofit = new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create(g)).build();
usuarioService service = retrofit.create(usuarioService.class);
Call<String> user = service.verificarUsuario(login.getText().toString(), senha.getText().toString());
user.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
String resultado = response.body();
if (resultado.equals("false")) {
Toast toast = Toast.makeText(MainActivity.this, "Senha ou usuário não existente", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP | Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
} else { //TOAST LOGIN
if (resultado.equals("true")) {
Toast toast = Toast.makeText(MainActivity.this, "ACESSO PERMITIDO", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
Retrofit retrofit = new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create(g)).build();
usuarioService service = retrofit.create(usuarioService.class);
retrofit2.Call<List<String>> dados = service.verificarCargoENome(login.getText().toString());
dados.enqueue(new Callback<List<String>>() {
@Override
public void onResponse
(retrofit2.Call <List<String>> call, Response <List<String>>response)
{
if (response.isSuccessful()) {
List<usuarios> dados = response.body();
for (usuarios u : users) {
Log.i("USER", u.getNome());
Log.i("USER", "----------------------------------------------------------");
}
} else {
Log.i("USER", String.valueOf(response.code()));
Log.i("USER", "----------------------------------------------------------");
}
}
@Override
public void onFailure
(retrofit2.Call < List < usuarios >> call, Throwable t){
Log.i("USER", t.getMessage());
Log.i("USER", "----------------------------------------------------------");
}
});
String nome = bd.verificarUsuario(login.getText().toString());
String cargo = bd.verificarCargo(login.getText().toString());
Intent intent = new Intent(MainActivity.this, MenuDrawer.class);
intent.putExtra("chave1", nome);
intent.putExtra("chave2", cargo);
startActivity(intent);
finish();
}
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
}
});
}
}
}
}
//CHAMA UMA ACTIVITY (TELA)
void recuperarSenha(View view) {
Intent intent = new Intent(this, recuperarSenha.class);
startActivity(intent);
}
}