我有一个应用程序,我正在设置近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)
请建议使用它的优点和缺点.
我得到记忆问题,这就是我问这个问题的原因.
我在使用时在片段中出现了空指针异常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)