Weitere ähnliche Inhalte
Ähnlich wie 京都Gtugコンパチapi (20)
Mehr von Masafumi Terazono (20)
Kürzlich hochgeladen (20)
京都Gtugコンパチapi
- 1. Now Loading. Please Wait ...
GTUG Android
Android Android3.0
Re:Kayo-System Co.,Ltd.
2011 10 22
- 14. Fragment fr = new MyFragment();
FragmentTransaction tr =
getSupportFragmentManager().beginTransaction();
tr.add(fr, "MyFragment");
tr.commit();
Re:Kayo-System Co.,Ltd.
2011 10 22
- 16. public Fragment createFragment(int n){
MyFragment f = new MyFragment();
Bundle bundle = new Bundle();
bundle.putInt("num", n);
f.setArguments(bundle);
return f;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(savedInstanceState!=null){
n = savedInstanceState.getInt("num");
}
else{
Bundle bundle = getArguments();
if(bundle!=null){
n = bundle.getInt("num");
}
}
}
Re:Kayo-System Co.,Ltd.
2011 10 22
- 18. Fragment fr = new MyFragment(n++);
FragmentTransaction tr =
getSupportFragmentManager().beginTransaction();
tr.replace(R.id.frameLayout1, fr);
tr.addToBackStack("task");
tr.commit();
Re:Kayo-System Co.,Ltd.
2011 10 22
- 19. Fragment f =
getSupportFragmentManager().
findFragmentByTag("tag");
Re:Kayo-System Co.,Ltd.
2011 10 22
- 24. class MyAsyncTask extends AsyncTask<Void, Void, Void>{
Handler handler;
Context context;
@Override
protected Void doInBackground(Void... params) {
Cursor cur =
context.getContentResolver().query(
Media.EXTERNAL_CONTENT_URI,
null, null, null, null);
handler.sendMessage(handler.obtainMessage(0, cur));
return null;
}
}
Re:Kayo-System Co.,Ltd.
2011 10 22
- 27. LoaderCallbacks<T>
Bundle bundle = new Bundle();
getSupportLoaderManager().initLoader(
R.layout.main, bundle, this);
Re:Kayo-System Co.,Ltd.
2011 10 22
- 28. Bundle bundle = new Bundle();
getSupportLoaderManager().restartLoader(
R.layout.main, bundle, this);
Re:Kayo-System Co.,Ltd.
2011 10 22
- 29. @Override
public void onDestroy() {
super.onDestroy();
getLoaderManager().destroyLoader(R.layout.main);
}
Re:Kayo-System Co.,Ltd.
2011 10 22
- 30. LoaderCallbacks<T>
public static class MyLoaderFragment extends Fragment implements
LoaderCallbacks<Cursor>{
CursorAdapter adapter;
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
return new CursorLoader(getActivity(),
Media.EXTERNAL_CONTENT_URI,
null, null, null, null);
}
public void onLoadFinished(Loader<Cursor> arg0, Cursor arg1) {
Cursor cur = adapter.swapCursor(arg1);
}
public void onLoaderReset(Loader<Cursor> arg0) {
}
}
Re:Kayo-System Co.,Ltd.
2011 10 22
- 32. public static class MyLoaderFragment2 extends Fragment implements
LoaderCallbacks<List<ValueItem>>{
public Loader<List<ValueItem>> onCreateLoader(int arg0, Bundle arg1) {
// TODO Auto-generated method stub
return null;
}
public void onLoadFinished(Loader<List<ValueItem>> arg0,
List<ValueItem> arg1) {
// TODO Auto-generated method stub
}
public void onLoaderReset(Loader<List<ValueItem>> arg0) {
// TODO Auto-generated method stub
}
}
Re:Kayo-System Co.,Ltd.
2011 10 22
- 33. static class MyAsyncTaskLoader extends AsyncTaskLoader<List<ValueItem>>{
public MyAsyncTaskLoader(Context context) {
super(context);
}
@Override
public List<ValueItem> loadInBackground() {
List<ValueItem> list = new ArrayList<ValueItem>();
return list;
}
}
public Loader<List<ValueItem>> onCreateLoader(int arg0, Bundle arg1) {
MyAsyncTaskLoader l = new MyAsyncTaskLoader(getActivity());
l.forceLoad();
return l;
}
Re:Kayo-System Co.,Ltd.
2011 10 22
- 39. public static class MyAdapter extends FragmentPagerAdapter {
public MyAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return NUM_ITEMS;
}
@Override
public Fragment getItem(int position) {
return ArrayListFragment.newInstance(position);
}
}
Re:Kayo-System Co.,Ltd.
2011 10 22