Getting the android context in an adapter

Obtaining the Context in the constructor has (at least) three advantages:

  1. You only do it once, not every time, getView() is called.
  2. You can use it for other purposes too, when needed.
  3. It also works, when parent is null.

However, if you don’t have any problems with your solution, you might as well stick to it.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)