본문 바로가기

안드로이드

[Android] android.content.ActivityNotFoundException [Android] android.content.ActivityNotFoundExceptionProblem : AndroidManifest.xml에 Activity 항목을 추가를 안해서 에러가 발생 android.content.ActivityNotFoundException: Unable to find explicit activity class {kr.co.xxxx .viewtest/kr.co.xxxx.viewtest.BlogActivity}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1820) at an.. 더보기
[Android] View Collapse & Expand Animation Collpase & Expand AnimationCollpase/Expand UI를 만들 때, Animation을 주는 방법TransitionManager를 이용하면 간단하게 만들 수 있다! TransitionManager.beginDelayedTransition(ViewGroup, Transition) // ViewGroup은 root view를 넣어주면 된다.Transition의 종류Android 5.0(API 레벨 21) 이하에서 사용할 경우AutoTransition() : Android가 자동으로 Animation을 설정ChangeBound() : Collpase/Expand AnimationAndroid 5.0(API 레벨 21) 이상일 경우(위 2개 포함)는 아래 주소 참조 https://de.. 더보기
[Android] Google Play Store로 이동시키기 Google Play Store로 이동시키기앱 리뷰 남기기 위한 유도 팝업(MaterialDialog 사용)app/build.grade dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile('com.github.afollestad.material-dialogs:commons:0.8.5.5@aar') { transitive = true } ...} Source public void goPlayStore(String content, String positiveText, String negativeText) { new MaterialDialog.Builder(ReviewActiv.. 더보기
[Android] 선택 되었을 때 Text Color 바꾸기 Change Select Text Color(TextView, Button).md Change Select Text Color(TextView, Button)drawable를 만들지 않고 select text color 변경하기(Util)TextView나 Button에서 press나 select 되었을 때, text color를 바꾸려면 아래와 같이 drawable에 selector를 만들어 줘야한다. 그리고 여러 색을 사용할 경우 사용할 때마다 selector를 만들어 줘야한다. xxxxxxxxxx6123 4 5 6그래서, 코드에서 함수로 만들었습니다.(Util같은 곳에 추가해서 사용하시면 될 것 같습니다.)(단, Button과 TextView만 해놓았습니다. 추가하시려면 if문 조건대로 추가하시면 됩.. 더보기
[Android] Square ImageView (정사각형 ImageView) Square ImageView(Custom) → 프로필 사진이나 기타 사진등을 정사각형으로 보여주기 위해 만들게 됨(특히 LinearLayout에서 비율로 보여줄때) Source Code → 기준(mFit)을 입력 받아 onMeasure함수에서 기준에 따라 크기를 정함. 1) SquareImageView.javaimport android.content.Context; import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.AttributeSet; public class SquareImageView extends android.support.v7.widget.AppCompatImageView .. 더보기
[Android] Spannable [ Spannable ] : TextView를 여러 개 쓰지 않아도 하나의 TextView에서 해당 text를 부분적으로 바꿀 수 있다. SpnnableUtils.javaimport android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.style.AbsoluteSizeSpan; import android.text.style.ForegroundColorSpan; import android.text.style.RelativeSizeSpan; /** * Created by gpark on 2017-01-31. */ public class SpannableUtils { /** * @param text : 적용.. 더보기
[Android] GPS 설정 체크하기 [ Android GPS Check ] public boolean checkGPSService() { LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { // GPS OFF 일때 Dialog 표시 new MaterialDialog.Builder(this) .title("위치 서비스 설정") .content("위치 서비스 기능(GPS)을 설정해주세요.") .positiveText("확인") .onPositive(new MaterialDialog.SingleButtonCallback() { .. 더보기
[Android] Volley & Patch request [ Android Patch request ] 1. HttpPost의 Header에 X-HTTP-Method-Override 추가 httpost.setHeader("X-HTTP-Method-Override", "PATCH"); 2. 위 1번 방법이 되지 않을 경우 okHttp 활용(Android Studio 기준) I) build.gradle에 library 추가 dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) ... compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0' } II) CustomHttpStack .. 더보기
[Android] 외부 앱 실행 [Android] 외부 앱 실행 앱 정보 얻어오기 12345678910Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); // package Infomation PackageManager pm = getPackageManager(); // 설치되어 있는 App 정보 List installedApps = pm.queryIntentActivities(intent, 0); for(ResolveInfo app : installedApp) { Log.i("App Info : ", app.activityInfo.packageName); } 외부 앱 실행시키기 실행시킬 앱의 Activity Name까지.. 더보기
[Android] Android Soft KeyBoard Show and Hide [Android] Android Soft KeyBoard Show and Hide Android 키보드 보이기 12345private void showKeyBoard() { EditText editText = ...; InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInputFromInputMethod (editText.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED); } Android 키보드 감추기 12345private void hideKeyBoard() { EditText editText = ...;.. 더보기