samedi 12 novembre 2016

Code inside of an if statement running no matter what. Any help would be greatly appreciated

So I made an impossible argument in an if statement just to assure myself that something else could run, and it didn't. My code looks like this;

`if (5 == 2) {
        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
               //run a bunch of code
            }


        });
    }`

Regardless of the fact that nothing in this if statement should run, when I click on of the list view things, it does. Does anyone see any problems with this? Also, one more question, is it possible to have two adapters in one activity? I want to fill two TextViews with different data, but the problem is they are both in the same activity, and since its seemingly impossible to make two custom constructors in a custom ArrayAdapter class, I can't see how I can initialize another adapter. Any Help??

Aucun commentaire:

Enregistrer un commentaire