小编Int*_*der的帖子

将largeHeap设置为true有什么好处?

我有一个应用程序,我正在设置近50个类android:largeHeap="true",如下所示.这是一个好习惯吗?

<application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="Mall"
        android:largeHeap="true"
        android:logo="@drawable/logo_for_up"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme" >
</application>
Run Code Online (Sandbox Code Playgroud)

请建议使用它的优点和缺点.

我得到记忆问题,这就是我问这个问题的原因.

android android-largeheap

102
推荐指数
5
解决办法
7万
查看次数

我在GridView Android中收到Null Pointer Exception

我在使用时在片段中出现了空指针异常Gridview。我的代码是

public class HomeFragment extends Fragment {
    GridView grid;
    String[] web = { "Bata", "Service", "puma", "Hush" };
    int[] imageId = { R.drawable.shoesmall, R.drawable.shoe1, R.drawable.shoe3,
            R.drawable.shoe4 };

    public HomeFragment(){}

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

       View rootView = inflater.inflate(R.layout.fragment_home, container, false);
     //   ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_home, container);

        CustomGrid adapter = new CustomGrid(getActivity().getApplicationContext(), web, imageId);
        grid = (GridView) getView().findViewById(R.id.gridview);
        grid.setAdapter(adapter);
        grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) …
Run Code Online (Sandbox Code Playgroud)

java android gridview

5
推荐指数
1
解决办法
294
查看次数

标签 统计

android ×2

android-largeheap ×1

gridview ×1

java ×1