동적 SQL : 상황에 따라 내용이 달라지는 SQL
저장 프로시저 : 일련의 조작을 프로그램으로 묶어서 RDBMS에 저장하는 장치
'API_Demo'에 해당되는 글 136건
- 2010.03.17 용어
- 2010.03.16 APP_Alarm_AlarmController
- 2010.03.16 APP_Activity_Wallpaper
- 2010.03.16 APP_Activity_TranslucentBlurActivity
- 2010.03.16 APP_Activity_TranslucentActivity
- 2010.03.16 APP_Activity_SetWallpaper
- 2010.03.16 APP_Activity_ReorderActivities
- 2010.03.16 APP_Activity_Redirection
- 2010.03.16 APP_Activity_ReceiveResult
- 2010.03.15 APP_Activity_Persistent State
- 2010.03.15 APP_Activity_Hello World
- 2010.03.15 APP_Activity_Forwarding
- 2010.03.15 APP_Activity_Dialog
- 2010.03.15 APP_Activity_Custom Title
- 2010.03.15 APP_Activiy_Custom Dialog
- 2010.02.22 APP_Activiy_Animation [Fade in, Zoom in]
[AlarmController.java]
private OnClickListener mOneShotListener = new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(AlarmController.this, OneShotAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
0, intent, 0);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 30);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(AlarmController.this,R.string.one_shot_scheduled,
Toast.LENGTH_LONG);
mToast.show();
}
};
private OnClickListener mStartRepeatingListener = new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
0, intent, 0);
long firstTime = SystemClock.elapsedRealtime();
firstTime += 15*1000;
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
firstTime, 15*1000, sender);.
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(AlarmController.this,
R.string.repeating_scheduled, Toast.LENGTH_LONG);
mToast.show();
}
};
private OnClickListener mStopRepeatingListener = new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast
(AlarmController.this, 0, intent, 0);
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.cancel(sender);
if (mToast != null) {
mToast.cancel();
}
mToast = Toast.makeText(AlarmController.this,
R.string.repeating_unscheduled, Toast.LENGTH_LONG);
mToast.show();
}
};
}
[OneShotAlarm.java]
{
@Override
public void onReceive(Context context, Intent intent)
{
Toast.makeText(context, R.string.one_shot_received,
Toast.LENGTH_SHORT).show();
}
}
[RepeatingAlarm.java]
{
@Override
public void onReceive(Context context, Intent intent)
{
Toast.makeText(context, R.string.repeating_received,
Toast.LENGTH_SHORT).show();
}
}
[Manifest.xml]
<receiver android:name=".app.OneShotAlarm" android:process=":remote" />
<receiver android:name=".app.RepeatingAlarm" android:process=":remote" />
<activity android:name=".app.AlarmController"
adroid:label="@string/activity_alarm_controller">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<service android:name=".app.AlarmService_Service"
android:process=":remote" />
'old > API_Demo' 카테고리의 다른 글
APP_Dialog_AlertDialogSamples (0) | 2010.03.22 |
---|---|
APP_Alarm_AlarmService (0) | 2010.03.22 |
APP_Activity_Wallpaper (0) | 2010.03.16 |
APP_Activity_TranslucentBlurActivity (0) | 2010.03.16 |
APP_Activity_TranslucentActivity (0) | 2010.03.16 |
android:label="@string/activity_wallpaper"
android:theme="@style/Theme.Wallpaper">
[styles.xml]
<item name="android:colorForeground">#fff</item>
</style>
'old > API_Demo' 카테고리의 다른 글
APP_Alarm_AlarmService (0) | 2010.03.22 |
---|---|
APP_Alarm_AlarmController (0) | 2010.03.16 |
APP_Activity_TranslucentBlurActivity (0) | 2010.03.16 |
APP_Activity_TranslucentActivity (0) | 2010.03.16 |
APP_Activity_SetWallpaper (0) | 2010.03.16 |
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
[Manifest.xml]
android:label="@string/activity_translucent_blur"
android:theme="@style/Theme.Transparent">
[styles.xml]
<item name="android:windowBackground">
@drawable/translucent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
'old > API_Demo' 카테고리의 다른 글
APP_Alarm_AlarmController (0) | 2010.03.16 |
---|---|
APP_Activity_Wallpaper (0) | 2010.03.16 |
APP_Activity_TranslucentActivity (0) | 2010.03.16 |
APP_Activity_SetWallpaper (0) | 2010.03.16 |
APP_Activity_ReorderActivities (0) | 2010.03.16 |
android:label="@string/activity_translucent"
android:theme="@style/Theme.Translucent">
[styles.xml]
<item name="android:windowBackground">
@drawable/translucent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
'old > API_Demo' 카테고리의 다른 글
APP_Activity_Wallpaper (0) | 2010.03.16 |
---|---|
APP_Activity_TranslucentBlurActivity (0) | 2010.03.16 |
APP_Activity_SetWallpaper (0) | 2010.03.16 |
APP_Activity_ReorderActivities (0) | 2010.03.16 |
APP_Activity_Redirection (0) | 2010.03.16 |
[SetWallpaperActivity.java]
final WallpaperManager wallpaperManager =
WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
final ImageView imageView = (ImageView) findViewById(R.id.imageview);
imageView.setDrawingCacheEnabled(true);
imageView.setImageDrawable(wallpaperDrawable);
Button randomize = (Button) findViewById(R.id.randomize);
randomize.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
int mColor = (int) Math.floor(Math.random() * mColors.length);
wallpaperDrawable.setColorFilter(mColors[mColor],
PorterDuff.Mode.MULTIPLY);
imageView.setImageDrawable(wallpaperDrawable);
imageView.invalidate();
}
});
Button setWallpaper = (Button) findViewById(R.id.setwallpaper);
setWallpaper.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
try {
wallpaperManager.setBitmap(imageView.getDrawingCache());
finish();
} catch (IOException e) {
e.printStackTrace();
}
* Drawable class로 그림을 그리고 WallpaperManager로 바탕화면을 지정한다.
'old > API_Demo' 카테고리의 다른 글
APP_Activity_TranslucentBlurActivity (0) | 2010.03.16 |
---|---|
APP_Activity_TranslucentActivity (0) | 2010.03.16 |
APP_Activity_ReorderActivities (0) | 2010.03.16 |
APP_Activity_Redirection (0) | 2010.03.16 |
APP_Activity_ReceiveResult (0) | 2010.03.16 |
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
* FLAG_ACTIVITY_REORDER_TO_FRONT는 ReorderTwo.class를 stack의 가장 위로 이동시킨다.
'old > API_Demo' 카테고리의 다른 글
APP_Activity_TranslucentActivity (0) | 2010.03.16 |
---|---|
APP_Activity_SetWallpaper (0) | 2010.03.16 |
APP_Activity_Redirection (0) | 2010.03.16 |
APP_Activity_ReceiveResult (0) | 2010.03.16 |
APP_Activity_Persistent State (0) | 2010.03.15 |
startActivity(intent);
[RedirectMain.java]
static final int INIT_TEXT_REQUEST = 0;
static final int NEW_TEXT_REQUEST = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.redirect_main);
if (!loadPrefs()) {
Intent intent = new Intent(this, RedirectGetter.class);
startActivityForResult(intent, INIT_TEXT_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (requestCode == INIT_TEXT_REQUEST) {
if (resultCode == RESULT_CANCELED) {
finish();
} else {
loadPrefs();
}
} else if (requestCode == NEW_TEXT_REQUEST) {
if (resultCode != RESULT_CANCELED) {
loadPrefs();
}
}
}
SharedPreferences preferences = getSharedPreferences("RedirectData", 0);
if (mTextPref != null) {
TextView text = (TextView)findViewById(R.id.text);
text.setText(mTextPref);
return true;
}
}
public void onClick(View v) {
SharedPreferences preferences = getSharedPreferences("RedirectData", 0);
preferences.edit().remove("text").commit();
finish();
}
};
public void onClick(View v) {
Intent intent = new Intent(RedirectMain.this, RedirectGetter.class);
startActivityForResult(intent, NEW_TEXT_REQUEST);
}
};
}
[RedirectGetter.java]
private final boolean loadPrefs()
{
SharedPreferences preferences = getSharedPreferences("RedirectData", 0);
mTextPref = preferences.getString("text", null);
if (mTextPref != null) {
mText.setText(mTextPref);
return true;
}
return false;
}
private OnClickListener mApplyListener = new OnClickListener()
{
public void onClick(View v)
{
SharedPreferences preferences = getSharedPreferences("RedirectData", 0);
SharedPreferences.Editor editor = preferences.edit();
editor.putString("text", mText.getText().toString());
if (editor.commit()) {
setResult(RESULT_OK);
}
finish();
}
};
// "RedirectData"는 String name, "text"는 String key
** RedirectEnter.java에서 RedirectMain.java를 호출하고 RedirectMain은 prefrences의 내용 유무에 따라서 sub activity를 실행하여 그 데이터를 저장하고 출력한다. **
'old > API_Demo' 카테고리의 다른 글
APP_Activity_SetWallpaper (0) | 2010.03.16 |
---|---|
APP_Activity_ReorderActivities (0) | 2010.03.16 |
APP_Activity_ReceiveResult (0) | 2010.03.16 |
APP_Activity_Persistent State (0) | 2010.03.15 |
APP_Activity_Hello World (0) | 2010.03.15 |
[ReceiveResult.java]
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (requestCode == GET_CODE) {
Editable text = (Editable)mResults.getText();
if (resultCode == RESULT_CANCELED) {
text.append("(cancelled)");
} else {
text.append("(okay ");
text.append(Integer.toString(resultCode));
text.append(") ");
if (data != null) {
text.append(data.getAction());
}
}
text.append("\n");
}
}
static final private int GET_CODE = 0;
private OnClickListener mGetListener = new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent (ReceiveResult.this, SendResult.class);
startActivityForResult(intent, GET_CODE);
}
};
[SendResult.java]
private OnClickListener mCorkyListener = new OnClickListener()
{
public void onClick(View v)
{
setResult(RESULT_OK, (new Intent()).setAction("Corky!"));
finish();
}
};
private OnClickListener mVioletListener = new OnClickListener()
{
public void onClick(View v)
{
setResult(RESULT_OK, (new Intent()).setAction("Violet!"));
finish();
}
};
}
Activity는 RESULT_OK, RESULT_CANCELED,RESULT_FIRST_USER 를 반환한다.
'old > API_Demo' 카테고리의 다른 글
APP_Activity_ReorderActivities (0) | 2010.03.16 |
---|---|
APP_Activity_Redirection (0) | 2010.03.16 |
APP_Activity_Persistent State (0) | 2010.03.15 |
APP_Activity_Hello World (0) | 2010.03.15 |
APP_Activity_Forwarding (0) | 2010.03.15 |
example of SharedPreferences
[PersistentState.java]
@Override
protected void onResume() {
super.onResume();
SharedPreferences prefs = getPreferences(0);
String restoredText = prefs.getString("text", null);
if (restoredText != null) {
mSaved.setText(restoredText, TextView.BufferType.EDITABLE);
int selectionStart = prefs.getInt("selection-start", -1);
int selectionEnd = prefs.getInt("selection-end", -1);
if (selectionStart != -1 && selectionEnd != -1) {
mSaved.setSelection(selectionStart, selectionEnd);
}
}
}
@Override
protected void onPause() {
super.onPause();
SharedPreferences.Editor editor = getPreferences(0).edit();
editor.putString("text", mSaved.getText().toString());
editor.putInt("selection-start", mSaved.getSelectionStart());
editor.putInt("selection-end", mSaved.getSelectionEnd());
editor.commit();
}
private EditText mSaved;
}
[Manifest.xml]
android:label="@string/activity_persistent"
android:windowSoftInputMode="stateVisible|adjustResize"> - 소프트 입력키
<intent-filter>
[save_restore_state.xml]
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/green"
android:text="@string/initial_text"
android:freezesText="true"> - 뷰에 기본으로 출력 될 텍스트
<requestFocus /> - 포커스를 지정
'old > API_Demo' 카테고리의 다른 글
APP_Activity_Redirection (0) | 2010.03.16 |
---|---|
APP_Activity_ReceiveResult (0) | 2010.03.16 |
APP_Activity_Hello World (0) | 2010.03.15 |
APP_Activity_Forwarding (0) | 2010.03.15 |
APP_Activity_Dialog (0) | 2010.03.15 |
<string name="hello_world"><b>Hello, <i>World!</i></b></string>
* html tag 사용
<b> bold, <i> italic
'old > API_Demo' 카테고리의 다른 글
APP_Activity_ReceiveResult (0) | 2010.03.16 |
---|---|
APP_Activity_Persistent State (0) | 2010.03.15 |
APP_Activity_Forwarding (0) | 2010.03.15 |
APP_Activity_Dialog (0) | 2010.03.15 |
APP_Activity_Custom Title (0) | 2010.03.15 |
[Forwarding.java]
Button goButton = (Button)findViewById(R.id.go);
goButton.setOnClickListener(mGoListener);
}
private OnClickListener mGoListener = new OnClickListener()
{
public void onClick(View v)
{
Intent intent = new Intent();
intent.setClass(Forwarding.this, ForwardTarget.class);
startActivity(intent);
finish();
}
};
[ForwardTarget.java]
[Manifest.xml]
<activity android:name=".app.ForwardTarget">
</activity>
'old > API_Demo' 카테고리의 다른 글
APP_Activity_Persistent State (0) | 2010.03.15 |
---|---|
APP_Activity_Hello World (0) | 2010.03.15 |
APP_Activity_Dialog (0) | 2010.03.15 |
APP_Activity_Custom Title (0) | 2010.03.15 |
APP_Activiy_Custom Dialog (0) | 2010.03.15 |
setContentView(R.layout.dialog_activity);
getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);
[Manifest.xml]
android:label="@string/activity_dialog"
android:theme="@android:style/Theme.Dialog">
'old > API_Demo' 카테고리의 다른 글
APP_Activity_Hello World (0) | 2010.03.15 |
---|---|
APP_Activity_Forwarding (0) | 2010.03.15 |
APP_Activity_Custom Title (0) | 2010.03.15 |
APP_Activiy_Custom Dialog (0) | 2010.03.15 |
APP_Activiy_Animation [Fade in, Zoom in] (0) | 2010.02.22 |
setContentView(R.layout.custom_title);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1);
[Manifest.xml]
android:label="@string/activity_custom_title"
android:windowSoftInputMode="stateVisible|adjustPan">
[custom_title_1]
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:id="@+id/left_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="@string/custom_title_left" />
<TextView android:id="@+id/right_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="@string/custom_title_right" />
</RelativeLayout>
'old > API_Demo' 카테고리의 다른 글
APP_Activity_Hello World (0) | 2010.03.15 |
---|---|
APP_Activity_Forwarding (0) | 2010.03.15 |
APP_Activity_Dialog (0) | 2010.03.15 |
APP_Activiy_Custom Dialog (0) | 2010.03.15 |
APP_Activiy_Animation [Fade in, Zoom in] (0) | 2010.02.22 |
[Manifest.xml]
android:label="@string/activity_custom_dialog"
android:theme="@style/Theme.CustomDialog">
[styles.xml]
<item name="android:windowBackground">@drawable/filled_box</item>
</style>
[filled_box.xml]
<solid android:color="#f0600000"/>
<stroke android:width="3dp" color="#ffff8080"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
'old > API_Demo' 카테고리의 다른 글
APP_Activity_Hello World (0) | 2010.03.15 |
---|---|
APP_Activity_Forwarding (0) | 2010.03.15 |
APP_Activity_Dialog (0) | 2010.03.15 |
APP_Activity_Custom Title (0) | 2010.03.15 |
APP_Activiy_Animation [Fade in, Zoom in] (0) | 2010.02.22 |
[Fade in]
overridePendingTransition(R.anim.fade, R.anim.hold);
[Zoom in]
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
<fade.xml>
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_longAnimTime" />
<hold.xml>
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXDelta="0" android:toXDelta="0"
android:duration="@android:integer/config_longAnimTime" />
<zoom_enter.xml>
android:interpolator="@android:anim/decelerate_interpolator">
<scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
<zoom_exit.xml>
android:interpolator="@android:anim/decelerate_interpolator"
android:zAdjustment="top">
<scale android:fromXScale="1.0" android:toXScale=".5"
android:fromYScale="1.0" android:toYScale=".5"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
-----------------------------------------------------------
public void overridePendingTransition (int enterAnim, int exitAnim)
Call immediately after one of the flavors of startActivity(Intent)
or finish()
to specify an explicit transition animation to perform next.
Parameters
enterAnim | A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation. |
---|---|
exitAnim | A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation. |
'old > API_Demo' 카테고리의 다른 글
APP_Activity_Hello World (0) | 2010.03.15 |
---|---|
APP_Activity_Forwarding (0) | 2010.03.15 |
APP_Activity_Dialog (0) | 2010.03.15 |
APP_Activity_Custom Title (0) | 2010.03.15 |
APP_Activiy_Custom Dialog (0) | 2010.03.15 |