Program: 143890
Project: 143890
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  networkEngine=NetworkEngine.getInstance(this);
  databaseEngine=DatabaseEngine.getInstance(this);
  preferences=PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
  button_login=(ImageButton)findViewById(R.id.button_login);
  button_login.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      login();
    }
  }
);
  button_logout=(ImageButton)findViewById(R.id.button_logout);
  button_web=(ImageButton)findViewById(R.id.button_web);
  button_del=(Button)findViewById(R.id.button_del);
  button_del.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String username=spinner_user_list.getSelectedItem().toString();
      ManagerUserServices managerUserServices=new ManagerUserServices(MainActivity.this);
      managerUserServices.delete(spinner_user_list.getSelectedItem().toString());
      spinnerUpdateFlag=false;
      updateHomescreenData();
    }
  }
);
  button_add=(Button)findViewById(R.id.button_add);
  button_add.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      ManagerUserServices managerUserServices=new ManagerUserServices(MainActivity.this);
      managerUserServices.add(getLayoutInflater());
    }
  }
);
  button_edit=(Button)findViewById(R.id.button_edit);
  button_edit.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      LayoutInflater inflater=getLayoutInflater();
      ManagerUserServices managerUserServices=new ManagerUserServices(MainActivity.this);
      managerUserServices.update(spinner_user_list.getSelectedItem().toString(),inflater);
    }
  }
);
  user_list=databaseEngine.userList();
  adapter=new ArrayAdapter<String>(this,R.layout.spinner_layout,user_list);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
  spinner_user_list=(Spinner)findViewById(R.id.spinner_user_list);
  spinner_user_list.setAdapter(adapter);
  adapter.notifyDataSetChanged();
  spinnerUpdateFlag=false;
  spinner_user_list.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long l){
      parent.setSelection(pos);
    }
    @Override public void onNothingSelected(    AdapterView<?> adapterView){
    }
  }
);
  if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction().add(R.id.container,new PlaceholderFragment()).commit();
  }
  updateHomescreenData();
  startAnimation();
  String intentMethod=getIntent().getStringExtra("String_Node_Str");
  if (intentMethod != null && intentMethod.equals("String_Node_Str")) {
    login();
    finish();
  }
 else   if (intentMethod != null && intentMethod.equals("String_Node_Str")) {
    logout();
    finish();
  }
  boolean prefNeedPersistence=preferences.getBoolean(SettingsActivity.KEY_PERSISTENCE,SettingsActivity.DEFAULT_KEY_PERSISTENCE);
  boolean perfStartupLogin=preferences.getBoolean(SettingsActivity.KEY_STARTUP_LOGIN,SettingsActivity.DEFAULT_KEY_STARTUP_LOGIN);
  if (prefNeedPersistence) {
    startService(new Intent(this,LoginService.class));
  }
  if (perfStartupLogin)   login();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  networkEngine=NetworkEngine.getInstance(this);
  databaseEngine=DatabaseEngine.getInstance(this);
  preferences=PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
  button_login=(ImageButton)findViewById(R.id.button_login);
  button_login.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      login();
    }
  }
);
  button_logout=(ImageButton)findViewById(R.id.button_logout);
  button_web=(ImageButton)findViewById(R.id.button_web);
  button_del=(Button)findViewById(R.id.button_del);
  button_del.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      if (databaseEngine.isUserListEmpty()) {
        Toast.makeText(MainActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
        return;
      }
      String username=spinner_user_list.getSelectedItem().toString();
      ManagerUserServices managerUserServices=new ManagerUserServices(MainActivity.this);
      managerUserServices.delete(spinner_user_list.getSelectedItem().toString());
      spinnerUpdateFlag=false;
      updateHomescreenData();
    }
  }
);
  button_add=(Button)findViewById(R.id.button_add);
  button_add.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      ManagerUserServices managerUserServices=new ManagerUserServices(MainActivity.this);
      managerUserServices.add(getLayoutInflater());
    }
  }
);
  button_edit=(Button)findViewById(R.id.button_edit);
  button_edit.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      if (databaseEngine.isUserListEmpty()) {
        Toast.makeText(MainActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
        return;
      }
      LayoutInflater inflater=getLayoutInflater();
      ManagerUserServices managerUserServices=new ManagerUserServices(MainActivity.this);
      managerUserServices.update(spinner_user_list.getSelectedItem().toString(),inflater);
    }
  }
);
  user_list=databaseEngine.userList();
  adapter=new ArrayAdapter<String>(this,R.layout.spinner_layout,user_list);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
  spinner_user_list=(Spinner)findViewById(R.id.spinner_user_list);
  spinner_user_list.setAdapter(adapter);
  adapter.notifyDataSetChanged();
  spinnerUpdateFlag=false;
  spinner_user_list.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long l){
      parent.setSelection(pos);
    }
    @Override public void onNothingSelected(    AdapterView<?> adapterView){
    }
  }
);
  if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction().add(R.id.container,new PlaceholderFragment()).commit();
  }
  updateHomescreenData();
  startAnimation();
  String intentMethod=getIntent().getStringExtra("String_Node_Str");
  if (intentMethod != null && intentMethod.equals("String_Node_Str")) {
    login();
    finish();
  }
 else   if (intentMethod != null && intentMethod.equals("String_Node_Str")) {
    logout();
    finish();
  }
  boolean prefNeedPersistence=preferences.getBoolean(SettingsActivity.KEY_PERSISTENCE,SettingsActivity.DEFAULT_KEY_PERSISTENCE);
  boolean perfStartupLogin=preferences.getBoolean(SettingsActivity.KEY_STARTUP_LOGIN,SettingsActivity.DEFAULT_KEY_STARTUP_LOGIN);
  if (prefNeedPersistence) {
    startService(new Intent(this,LoginService.class));
  }
  if (perfStartupLogin)   login();
}