Tariq Ziad Tariq Ziad - 5 months ago 30
Android Question

Some nethods in my main Activity are showing as never used

These two methods

methods are not being used in this my main activity file. I could find the reason, I don't know where do I have to call them. I am using Android Studio.

public class MainActivity extends AppCompatActivity {

EditText userName, password;

DatabaseAdapter databaseHelper;

protected void onCreate(Bundle savedInstanceState) {

userName = (EditText) findViewById(R.id.editTextUser);
password = (EditText) findViewById(R.id.editTextPass);
databaseHelper = new DatabaseAdapter(this);

public void addUser(View view) {

String user = userName.getText().toString();
String pass = password.getText().toString();

long id = databaseHelper.insertData(user, pass);
if (id < 0) {
Message.message(this, "Unsuccessful");
} else {
Message.message(this, "Successful");

public void viewDetails(View view) {
String data = databaseHelper.getAllData();
Message.message(this, data);


After watching this code you are only declaring a function and give the definition of the function you are not using it or calling it .. any where that's why android studio show you not using this method's... You can call this method like addUser(); or viewDetails();