package net.yaht.m.hellores;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
// import android.support.v7.app.AppCompatActivity;

public class MainActivity extends Activity {


    ImageView _pic = null;
    int _img_flag = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // NOTE: now we are Ready to handle our resources via code /but not before setContentView/;

        _pic = (ImageView) findViewById(R.id._img_view_01);

        _pic.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                if (_img_flag == 1) {

                    ((ImageView) v).setImageDrawable(getResources().getDrawable(R.drawable.nature_02));
                    _img_flag = 2;

                } else {

                    ((ImageView) v).setImageDrawable(getResources().getDrawable(R.drawable.nature_01));
                    _img_flag = 1;

                }

                // ((ImageView) v).setImageDrawable(null);

            }

        });
    }
}
