PageRenderTime 17ms CodeModel.GetById 6ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/UniversalImageLoaderExample/src/com/nostra13/example/universalimageloader/BaseActivity.java

https://github.com/rashedulkabir/Android-Universal-Image-Loader
Java | 35 lines | 26 code | 6 blank | 3 comment | 1 complexity | cddf3ca4680bc7eebfd64d3b051a93cd MD5 | raw file
 1package com.nostra13.example.universalimageloader;
 2
 3import com.nostra13.universalimageloader.core.ImageLoader;
 4
 5import android.app.Activity;
 6import android.view.Menu;
 7import android.view.MenuItem;
 8
 9/**
10 * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
11 */
12public abstract class BaseActivity extends Activity {
13
14	protected ImageLoader imageLoader = ImageLoader.getInstance();
15
16	@Override
17	public boolean onCreateOptionsMenu(Menu menu) {
18		getMenuInflater().inflate(R.menu.main_menu, menu);
19		return true;
20	}
21
22	@Override
23	public boolean onOptionsItemSelected(MenuItem item) {
24		switch (item.getItemId()) {
25			case R.id.item_clear_memory_cache:
26				imageLoader.clearMemoryCache();
27				return true;
28			case R.id.item_clear_disc_cache:
29				imageLoader.clearDiscCache();
30				return true;
31			default:
32				return false;
33		}
34	}
35}