android - Res cannot be resolved with an ImageView -


I have a ImageView in my Android app I ImageView as a button of'm using when I pressed the button, then you should change the image in my code, it says Rhys can not be solved . My code is below:

  loginbtn.setOnClickListener (btnOnClickListener); Here, according to // convert images loginbtn.setOnTouchListener touch (New OnTouchListener () {@Override public boolean onTouch (see v, MotionEvent ARG1) {// TODO Auto-generated method stub // switch (arg1.getAction ()) {case MotionEvent.ACTION_DOWN: break {v.setImageBitmap (res.getDrawable (R.drawable.compare_now_click)); // Race break;} case MotionEvent.ACTION_CANCEL: {v.setImageBitmap (. res.getDrawable (R.drawable));; }} Return true, return;}});   

On the line:

  v.setImageBitmap (res.getDrawable (R.drawable.compare_now_click));   

I'm getting the error res can not be resolved . Why this may be happening

use instead :?

  ((imageView) v) .setImageResource (R.drawable.compare_now_click);   

Otherwise, you must first obtain the resource from the context, e.g. If you are in a activity , use the resource race = getResources ();

Also, does not meet your other image processing ID: R.drawable

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -