画像が更新されたら、プッシュ通知でAndroidに告知し、画像を表示してみる
import android.app.Activity; import android.os.Bundle; import android.widget.Toast; import xxxxxx.ImageCache; import xxxxxx.R; import xxxxxx.UrlImageView; import xxxxxx.UrlImageView.OnImageLoadListener; public class MainActivity extends Activity { private UrlImageView mImageView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mImageView = (UrlImageView)findViewById(R.id.imageView); mImageView.setImageUrl("http://k.yimg.jp/images/top/sp/logo.gif", imageLoadListener); } @Override public void onDestroy() { ImageCache.deleteAll(getCacheDir()); super.onDestroy(); } final private OnImageLoadListener imageLoadListener = new OnImageLoadListener() { @Override public void onStart(String url) { //Toast.makeText(getApplicationContext(), "start", Toast.LENGTH_SHORT).show(); } @Override public void onComplete(String url) { //Toast.makeText(getApplicationContext(), "end", Toast.LENGTH_SHORT).show(); } }; }
<uses-permission android:name="android.permission.INTERNET"/>
<xxxxxx.UrlImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>