Question: How can I set a web application to have an infinite session, so that the user doesn't get logged out after some time, even if the web application stays open for years ?

Answer: 
Ok, you are having errors because you are doing UI operations in a not UI thread. you can use the code below,

```
public class MainFragment extends Fragment {
View view;
ImageView i;
.
.
.
.

lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
.
.
.   

   getActivity().runOnUiThread(new Runnable() {
      public void run() {
         i = (ImageView)getActivity().findViewById(R.id.imgv);
      }
   });

```
please change to like

```
Animation animation1 = AnimationUtils.loadAnimation(MainFragment.this, R.anim.anim1);

```