少年辛苦终身事,莫向光阴惰寸功。这篇文章主要讲述Android初学第23天相关的知识,希望能为你提供帮助。
android初学第23天【Android初学第23天】10_FragmentArguments
代码
CrimeLab.java
package com.bignerdranch.android.criminalintent;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class CrimeLab {
private static CrimeLab sCrimeLab;
private List<
Crime>
mCrimes;
public static CrimeLab get(Context context) {
if (sCrimeLab == null) {
sCrimeLab = new CrimeLab(context);
}return sCrimeLab;
}private CrimeLab(Context context) {
mCrimes = new ArrayList<
>
();
for (int i = 0;
i <
100;
i++) {
Crime crime = new Crime();
crime.setTitle("Crime #" + i);
crime.setSolved(i % 2 == 0);
mCrimes.add(crime);
}
}public List<
Crime>
getCrimes() {
return mCrimes;
}public Crime getCrime(UUID id) {
for (Crime crime : mCrimes) {
if (crime.getId().equals(id)) {
return crime;
}
}return null;
}
}
CrimeListActivity.java
package com.bignerdranch.android.criminalintent;
import android.support.v4.app.Fragment;
public class CrimeListActivity extends SingleFragmentActivity {@Override
protected Fragment createFragment() {
return new CrimeListFragment();
}
}
推荐阅读
- Android初学第24天
- Pure.CSS剥离表格用例
- Pure.CSS堆叠表单
- Pure.CSS多列表单示例
- Pure.CSS输入尺寸表单
- android|开发一个简单APP的流程及记事本案例(Android Studio)
- windows8.1系统在高分屏下软件界面显示含糊怎样办
- Windows8系统电脑怎样防范U盘传播病毒
- Win8系统打开安全中心服务提示出错1068如何处理