ScrollView에 아래 property 추가

android:fillViewport="true"



[출처] View inside ScrollView doesn't take all place

[참고] ScrollView’s handy trick

Posted by bboks.net

댓글을 달아 주세요

맨 아래로 이동

 mScroll.fullScroll(View.FOCUS_DOWN); 


맨 위로 이동

 mScroll.fullScroll(View.FOCUS_UP); 

Posted by bboks.net

댓글을 달아 주세요

  1. 문종민 2015.02.02 17:19  댓글주소  수정/삭제  댓글쓰기

    오오 감사합니다. 헤매고 있었는데 잘 되네요 ㅎㅎ

웹뷰에 들어가는 html의 css에 다음 element 추가

-webkit-user-select: none;


[출처] webview no selection/copy&paste

Posted by bboks.net

댓글을 달아 주세요

boolean isNetworkConnectionAvailable() {
	ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
	NetworkInfo info = cm.getActiveNetworkInfo();
	if (info == null)
		return false;
	State network = info.getState();
	return (network == NetworkInfo.State.CONNECTED || network == NetworkInfo.State.CONNECTING);
}


[출처] How to check the network availability?

Posted by bboks.net

댓글을 달아 주세요

1. 플립 메소드

public static final int FLIP_VERTICAL = 1;
public static final int FLIP_HORIZONTAL = 2;

private Bitmap flipImage(Bitmap src, int type) {
	// create new matrix for transformation
	Matrix matrix = new Matrix();
	// if vertical
	if (type == FLIP_VERTICAL) {
		// y = y * -1
		matrix.preScale(1.0f, -1.0f);
	}
	// if horizonal
	else if (type == FLIP_HORIZONTAL) {
		// x = x * -1
		matrix.preScale(-1.0f, 1.0f);
		// unknown type
	} else {
		return null;
	}

	// return transformed image
	return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(),
			matrix, true);
}


2. 이미지 플립 시키미(호출쪽)

ImageView imgView = (ImageView) findViewById(R.id.imageView);
imgView.setImageBitmap(flipImage(BitmapFactory.decodeResource(getResources(), R.drawable.img), FLIP_VERTICAL );


[출처] Image Flipping (Mirroring) in ImageView (Android)

Posted by bboks.net

댓글을 달아 주세요

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_user_report);

	WebViwe webView = (WebView) findViewById(R.id.webview);

	CookieSyncManager.createInstance(this);
	cookieManager = CookieManager.getInstance();
	CookieSyncManager.getInstance().startSync();

	//도메인 url, 쿠키
	cookieManager.setCookie("user domain url", "cookie value");
}


[참조] Syncing cookies between an HttpClient and a WebView

Posted by bboks.net

댓글을 달아 주세요

package com.hrupin;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

public abstract class AppBaseActivity extends Activity {
	public static final String FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION = "com.hrupin.FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION";
	private BaseActivityReceiver baseActivityReceiver = new BaseActivityReceiver();
	public static final IntentFilter INTENT_FILTER = createIntentFilter();

	private static IntentFilter createIntentFilter() {
		IntentFilter filter = new IntentFilter();
		filter.addAction(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION);
		return filter;
	}

	protected void registerBaseActivityReceiver() {
		registerReceiver(baseActivityReceiver, INTENT_FILTER);
	}

	protected void unRegisterBaseActivityReceiver() {
		unregisterReceiver(baseActivityReceiver);
	}

	public class BaseActivityReceiver extends BroadcastReceiver {
		@Override
		public void onReceive(Context context, Intent intent) {
			if (intent.getAction().equals(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION)) {
				finish();
			}
		}
	}

	protected void closeAllActivities() {
		sendBroadcast(new Intent(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION));
	}
}


적용해야 하는 액티비티 구현시 AppBaseActivity를 상속하고

액티비티들을 종료하고 싶은때 sendBroadCast(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION) 메소드 호출 


[출처] How to finish all activities in your Android application through simple call

Posted by bboks.net

댓글을 달아 주세요