Contenu connexe Similaire à 夜子まま塾さくら (20) Plus de Masafumi Terazono (20) 夜子まま塾さくら34. eXtensible Markup Language
Re:Kayo-System Co.,Ltd.
2011 11 15
36. <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
Re:Kayo-System Co.,Ltd.
2011 11 15
37. <poem>
<pno>8</pno>
<mkana> </mkana>
<poet> ( )</poet>
<yomi>
( ) ( ) ( ) ( )
</yomi>
<image>image/m0008.jpg</image>
<mean> ( )
</mean>
</poem>
Re:Kayo-System Co.,Ltd.
2011 11 15
40. package jp.co.kayo.android.sample.activity;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Re:Kayo-System Co.,Ltd.
2011 11 15
41. <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
Re:Kayo-System Co.,Ltd.
2011 11 15
42. <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.co.kayo.android.sample.activity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Re:Kayo-System Co.,Ltd.
2011 11 15
44. Button button = (Button)findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//
}
});
Re:Kayo-System Co.,Ltd.
2011 11 15
56. Fragment fr = new MyFragment();
FragmentTransaction tr =
getSupportFragmentManager().beginTransaction();
tr.add(fr, "MyFragment");
tr.commit();
Re:Kayo-System Co.,Ltd.
2011 11 15
58. 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 11 15
60. 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 11 15
61. Fragment f =
getSupportFragmentManager().
findFragmentByTag("tag");
Re:Kayo-System Co.,Ltd.
2011 11 15
68. 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 11 15
71. LoaderCallbacks<T>
Bundle bundle = new Bundle();
getSupportLoaderManager().initLoader(
R.layout.main, bundle, this);
Re:Kayo-System Co.,Ltd.
2011 11 15
72. Bundle bundle = new Bundle();
getSupportLoaderManager().restartLoader(
R.layout.main, bundle, this);
Re:Kayo-System Co.,Ltd.
2011 11 15
73. @Override
public void onDestroy() {
super.onDestroy();
getLoaderManager().destroyLoader(R.layout.main);
}
Re:Kayo-System Co.,Ltd.
2011 11 15
74. 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 11 15
76. 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 11 15
77. 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 11 15