original source : http://www.androiddocs.com/training/wearables/ui/exit.html

Exiting Full-Screen Activities

By default, users exit Android Wear activities by swiping from left to right. If the app contains horizontally scrollable content, users first have to navigate to the edge of the content and then swipe again from left to right to exit the app.

왼쪽에서 오른쪽으로 swipe으로 exit하기 적당하지 않는 경우(예를 들어 맵을 보고 있는 경우) 

long-press-to-dismiss UI pattern 을 사용할수 있다.

DismissOverlayView class from the Wearable UI Library 을 사용하여 구현할수 있다. 

Disable the Swipe-To-Dismiss Gesture

long-press-to-dismiss UI 를 이용하는 경우 

<style name="AppTheme" parent="Theme.DeviceDefault">
   <item name="android:windowSwipeToDismiss">false</item>
</style>

를 사용하여 disable해야 한다.

Implement the Long Press to Dismiss Pattern

in your activity

<FrameLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_height="match_parent"
   android:layout_width="match_parent">

   <!-- other views go here -->

   <android.support.wearable.view.DismissOverlayView
       android:id="@+id/dismiss_overlay"
       android:layout_height="match_parent"
       android:layout_width="match_parent"/>
<FrameLayout>
public class WearActivity extends Activity {

   private DismissOverlayView mDismissOverlay;
   private GestureDetector mDetector;

   public void onCreate(Bundle savedState) {
       super.onCreate(savedState);
       setContentView(R.layout.wear_activity);

       // Obtain the DismissOverlayView element
       mDismissOverlay = (DismissOverlayView) findViewById(R.id.dismiss_overlay);
       mDismissOverlay.setIntroText(R.string.long_press_intro);
       mDismissOverlay.showIntroIfNecessary();

       // Configure a gesture detector
       mDetector = new GestureDetector(this, new SimpleOnGestureListener() {
           public void onLongPress(MotionEvent ev) {
               mDismissOverlay.show();
           }
       });
   }

   // Capture long presses
   @Override
   public boolean onTouchEvent(MotionEvent ev) {
       return mDetector.onTouchEvent(ev) || super.onTouchEvent(ev);
   }
}

original source : http://www.androiddocs.com/training/wearables/ui/exit.html

Exiting Full-Screen Activities

By default, users exit Android Wear activities by swiping from left to right. If the app contains horizontally scrollable content, users first have to navigate to the edge of the content and then swipe again from left to right to exit the app.

왼쪽에서 오른쪽으로 swipe으로 exit하기 적당하지 않는 경우(예를 들어 맵을 보고 있는 경우) 

long-press-to-dismiss UI pattern 을 사용할수 있다.

DismissOverlayView class from the Wearable UI Library 을 사용하여 구현할수 있다. 

Disable the Swipe-To-Dismiss Gesture

long-press-to-dismiss UI 를 이용하는 경우 

<style name="AppTheme" parent="Theme.DeviceDefault">
   <item name="android:windowSwipeToDismiss">false</item>
</style>

를 사용하여 disable해야 한다.

Implement the Long Press to Dismiss Pattern

in your activity

<FrameLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_height="match_parent"
   android:layout_width="match_parent">

   <!-- other views go here -->

   <android.support.wearable.view.DismissOverlayView
       android:id="@+id/dismiss_overlay"
       android:layout_height="match_parent"
       android:layout_width="match_parent"/>
<FrameLayout>
public class WearActivity extends Activity {

   private DismissOverlayView mDismissOverlay;
   private GestureDetector mDetector;

   public void onCreate(Bundle savedState) {
       super.onCreate(savedState);
       setContentView(R.layout.wear_activity);

       // Obtain the DismissOverlayView element
       mDismissOverlay = (DismissOverlayView) findViewById(R.id.dismiss_overlay);
       mDismissOverlay.setIntroText(R.string.long_press_intro);
       mDismissOverlay.showIntroIfNecessary();

       // Configure a gesture detector
       mDetector = new GestureDetector(this, new SimpleOnGestureListener() {
           public void onLongPress(MotionEvent ev) {
               mDismissOverlay.show();
           }
       });
   }

   // Capture long presses
   @Override
   public boolean onTouchEvent(MotionEvent ev) {
       return mDetector.onTouchEvent(ev) || super.onTouchEvent(ev);
   }
}

original source : http://www.androiddocs.com/training/wearables/ui/exit.html

Exiting Full-Screen Activities

By default, users exit Android Wear activities by swiping from left to right. If the app contains horizontally scrollable content, users first have to navigate to the edge of the content and then swipe again from left to right to exit the app.

왼쪽에서 오른쪽으로 swipe으로 exit하기 적당하지 않는 경우(예를 들어 맵을 보고 있는 경우) 

long-press-to-dismiss UI pattern 을 사용할수 있다.

DismissOverlayView class from the Wearable UI Library 을 사용하여 구현할수 있다. 

Disable the Swipe-To-Dismiss Gesture

long-press-to-dismiss UI 를 이용하는 경우 

<style name="AppTheme" parent="Theme.DeviceDefault">
   <item name="android:windowSwipeToDismiss">false</item>
</style>

를 사용하여 disable해야 한다.

Implement the Long Press to Dismiss Pattern

in your activity

<FrameLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_height="match_parent"
   android:layout_width="match_parent">

   <!-- other views go here -->

   <android.support.wearable.view.DismissOverlayView
       android:id="@+id/dismiss_overlay"
       android:layout_height="match_parent"
       android:layout_width="match_parent"/>
<FrameLayout>
public class WearActivity extends Activity {

   private DismissOverlayView mDismissOverlay;
   private GestureDetector mDetector;

   public void onCreate(Bundle savedState) {
       super.onCreate(savedState);
       setContentView(R.layout.wear_activity);

       // Obtain the DismissOverlayView element
       mDismissOverlay = (DismissOverlayView) findViewById(R.id.dismiss_overlay);
       mDismissOverlay.setIntroText(R.string.long_press_intro);
       mDismissOverlay.showIntroIfNecessary();

       // Configure a gesture detector
       mDetector = new GestureDetector(this, new SimpleOnGestureListener() {
           public void onLongPress(MotionEvent ev) {
               mDismissOverlay.show();
           }
       });
   }

   // Capture long presses
   @Override
   public boolean onTouchEvent(MotionEvent ev) {
       return mDetector.onTouchEvent(ev) || super.onTouchEvent(ev);
   }
}

Close application and remove from recent apps/

Close application and remove from recent apps/

android finish() method doesn’t clear app from memory

android finish() method doesn’t clear app from memory