幾つか気になったことを・・・
CODE:
public class Def {
public final static String TAG = new String("Qrowser");
public final static String INTENT_TAG = new String("SELECTED_ITEM");
public final static String sINTENT_EXTRA_TITLE = new String("ExTitle");
public final static String sINTENT_EXTRA_URL = new String("ExUrl");
}
new String("...")は単に"..."でよくないですか?
http://www.ne.jp/asahi/hishidama/home/t ... tml#String
BookMarkBindDataのコンストラクタは次のように書いた方が美しいかと
CODE:
public class BookMarkBindData {
public String mTitle;
public String mUrl;
public Bitmap mBmp;
public BookMarkBindData() {
this(null, null, null); // フィールドは初期値(オブジェクト型ならnull)で初期化されるのでこの行は無くても良い
}
public BookMarkBindData(String title, String url) {
this(title, url, null);
}
public BookMarkBindData(String title, String url, Bitmap bmp) {
mTitle = title;
mUrl = url;
mBmp = bmp;
}
}
http://www.ne.jp/asahi/hishidama/home/t ... ault_value
自分ならこう書きます。[追記]
CODE:
public class BookMarkBindData {
public String title;
public String url;
public Bitmap bmp;
public BookMarkBindData() {
this(null, null, null); // フィールドは初期値(オブジェクト型ならnull)で初期化されるのでこの行は無くても良い
}
public BookMarkBindData(String title, String url) {
this(title, url, null);
}
public BookMarkBindData(String title, String url, Bitmap bmp) {
this.title = title;
this.url = url;
this.bmp = bmp;
}
}
CODE:
public class Share {
public static Activity mActivity = null;
}
なんか、グローバルで怖いです・・・
CODE:
public void finalize(){ //デストラクタ
if( mBmp != null ){
// mBmp.recycle(); //ここでrecycleすると落ちる!しかししないとメモリリークする・・
}
}
protected void finalize() {
//ここでメモリリークが起きる
// これ以外にセットしたBmpを解放する方法が無いか?
/* //これでも落ちる
imageView.setImageDrawable(null);
if (ImageViewBmp != null) {
Log.d(Def.TAG, "ImageViewBmp.recycle()");
ImageViewBmp.recycle();
}
*/
}
android developers さんが書きました:
public void recycle ()
Since: API Level 1
Free the native object associated with this bitmap, and clear the reference to the pixel data. This will not free the pixel data synchronously; it simply allows it to be garbage collected if there are no other references. The bitmap is marked as "dead", meaning it will throw an exception if getPixels() or setPixels() is called, and will draw nothing. This operation cannot be reversed, so it should only be called if you are sure there are no further uses for the bitmap. This is an advanced call, and normally need not be called, since the normal GC process will free up this memory when there are no more references to this bitmap.
このビットマップに関連付けされたネイティブなオブジェクトを解放して、ピクセルデータへの参照を取り除きます。
これは同調してピクセルデータを解放することは無いでしょう。単に他に参照が無かった時にGCが起きることを許可します。
もしgetPixels()やsetPixels()が呼ばれたりすると例外を投げて、何も描画せずに、ビットマップが「死んでいる」ことを目立たせます。
このオペレーションを取り消すことはできません、なのでビットマップの用途がこれ以上ないと確信できる時だけこのメソッドを呼ぶべきです。
これは高度な呼び出しで、普通はこのビットマップへの参照が無くなるとGCがこのメモリを解放するので、通常は呼ばれる必要がありません。
落ちるのはmBmpやImageViewBmpが指すオブジェクトがまだ残っていてそれが実際に描画されているせいじゃないでしょうか。
どれぐらいのメモリリークが起きているのかが分からないのでアレですが、GCが回収するようになるまでほっといたらどうでしょう?
あと命名規則が・・・そのJavaじゃないですw