1
2
3
4
5
6
7
    <SeekBar
            android:id="@+id/seekBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:progress="50"
     />
 
cs

간-단

 

1
2
3
      Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"+"번호1;번호2"));
                intent.putExtra("sms_body","메세지 내용");
                This.startActivity(intent);
cs

 

main_menu_layout : 터치이벤트를 막고싶은 레이아웃의 id

1
        main_menu_layout.setClickable(true);
cs

 

1
2
3
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
fragmentManager.beginTransaction().remove(CalendarFragment.this).commit();
fragmentManager.popBackStack();
cs

 

참고 : https://m.blog.naver.com/PostView.nhn?blogId=tpgns8488&logNo=220603850137&proxyReferer=https%3A%2F%2Fwww.google.com%2F

 

Android Studio Fragment 종료 및 이전 페이지 돌아가기

작업 하다가 완료 버튼을 누르고 현재 Fragment를 없애고 이전 Fragment로 돌아갈 때 사용한다. Fragmen...

blog.naver.com

 

+ 현재 내가 사용하는 코드

1
2
3
4
5
6
7
8
9
10
11
    private void removeFragment(Fragment fragment) {
        if (fragment != null) {
            FragmentManager mFragmentManager = getActivity().getSupportFragmentManager();
            final FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction();
            mFragmentTransaction.remove(fragment);
            mFragmentTransaction.commit();
            fragment.onDestroy();
            fragment.onDetach();
            fragment = null;
        }
    }
cs
1
2
        floatingActionButton.setImageResource(R.drawable.f_btn_map)
 
cs

Activity class does not exist

안드로이드 기기를 컴퓨터와 연결한 상태에서 해당 앱을 삭제하면 나타나는 현상.

앱정보-> 사용중지 앱 에서 해당 앱을 제거 하면 된다.

  • 보통 새로운 액티비티는 오른쪽->왼쪽 방향으로 들어오고 끝나는 액티비티는 왼쪽->오른쪽 방향으로 나간다.

  • 구현상 문제로 강제로 설정해야 할 때 사용하면 된다.

 

- res/anim 폴더 안에 생성 (xml)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// anim_slide_in_left.xml (오른쪽->왼쪽 방향으로  들어오는 애니메이션)
 
<translate xmlns:android="http://schemas.android.com/apk/res/android"
 
    android:duration="250"
 
    android:fromXDelta="-100%"
 
    android:interpolator="@android:anim/decelerate_interpolator"
 
    android:toXDelta="0%" />
 
 
 
 
 
// anim_slide_out_right.xml (왼쪽->오른쪽 방향으로 나가는 애니메이션)
 
<translate xmlns:android="http://schemas.android.com/apk/res/android"
 
android:duration="250"
 
android:fromXDelta="0%"
 
android:interpolator="@android:anim/decelerate_interpolator"
 
android:toXDelta="100%" />
cs

 

- class 내에 선언 방법 (java)

1
2
3
startActivity(new Intent(현재Activity.this, 불러올Activity.class));
 
overridePendingTransition(R.anim.새로운(들어오는)Activity애니메이션R.anim.현재(사라질)Activity애니메이션);
cs

 

- 구현 예제 (kotlin)

1
2
3
4
5
6
7
8
9
10
11
fun backButtonClick(v: View?) {
 
this.finish()
 
val intent = Intent(this, ActivityQNAList::class.java)
 
startActivity(intent)
 
overridePendingTransition(R.anim.anim_slide_in_left, R.anim.anim_slide_out_right)
 
}
cs

 

 

 

참조: https://dwfox.tistory.com/26 [DWFOX]

+ Recent posts