2016年8月13日土曜日

エラー FloatingActionButton のインポートができない。 import android.support.design.widget.FloatingActionButton;

import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;

でエラーがでる!!

何でだ

調べたところ、ライブラリーのヴァージョンが悪いらしい。

compile 'com.android.support:design:23.4.0'

compile 'com.android.support:design:23.1.0'

に変更して、ビルドするとエラーがでなくなりました。

2016年7月28日木曜日

エラー java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams

Fragmentを用いた時にこのようなエラーがでた。

エラー java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams

原因

@Overridepublic void onAttach(Activity activity) {
    super.onAttach(activity);    try {
        mListener = (OnFragmentInteractionListener) activity;    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnFragmentInteractionListener");    }
}

onAttachのオーバーライド忘れ


オー恥ずかしい。。。。

格闘すること2時間でした。

2016年6月2日木曜日

エラー Expected resource oy type styleable 何も問題ないのに、R.も記述しているのに @SuppressWarnings("ResourceType")

そんなときはActivityの上に
@SuppressWarnings("ResourceType")


例)
@SuppressWarnings("ResourceType")

public class hogeActivity extends Activity implements OnTouchListener {


}


こうすると、エラーがでなくなります。