レイアウトでを使用しようとしてGridView
いますが、非静的メソッドへの静的参照を作成できないとコードに表示されています。GridView
aで aを使用するのは aFragment
と同じだと思いましたActivity
これは私のコードです:
public static class MiscFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
public static final String ARG_SECTION_NUMBER = "section_number";
public MiscFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.misc_fragment,
container, false);
GridView gridview = (GridView) findViewById(R.id.gridview);
return rootView;
}
}
次に、に設定gridview
しますAdapter
。現在、問題の原因は次のとおりです。findViewById(R.id.gridview);