Parcelable을 사용한 오브젝트 전달 (Object serialization using Parcelable)


http://arsviator.blogspot.kr/2010/10/parcelable%EC%9D%84-%EC%82%AC%EC%9A%A9%ED%95%9C-%EC%98%A4%EB%B8%8C%EC%A0%9D%ED%8A%B8-%EC%A0%84%EB%8B%AC-object.html


Posted by yespia.net piacom


사용예.


ArrayList<AccountInfo> arrAccountInfo = getAccountInfoList();


for (int i=0; i<arrAccountInfo.size(); i++) {

Log.d("값 확인", "account type : " + arrAccountInfo.get(i).getAccountType() + " / " + "account name : " + arrAccountInfo.get(i).getAccountName() );

}




//단말기 계정정보 얻기
public ArrayList<AccountInfo> getAccountList() {
ArrayList<AccountInfo> arrAccountInfo = new ArrayList<AccountInfo>();

Account[] accounts = AccountManager.get(this.context).getAccounts();
Account account = null;

for(int i=0;i<accounts.length;i++) {
account = accounts[i];
if ( (!account.type.equals("com.google") && account.name.toLowerCase().contains("phone")==true) || account.type.equals("com.google")) { //구글 및 폰 계정만 얻기
AccountInfo accountInfo = new AccountInfo();
accountInfo.setAccountType(account.type);
accountInfo.setAccountName(account.name);
arrAccountInfo.add(accountInfo);
}

}


return arrAccountInfo;

}



AccountInfo.java

public class AccountInfo {
String account_type;
String account_name;

public void setAccountType(String account_type) { this.account_type = account_type; }
public String getAccountType() { return this.account_type; }

public void setAccountName(String account_name) { this.account_name = account_name; }
public String getAccountName() { return this.account_name; }

}


Posted by yespia.net piacom

WebviewActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class WebviewActivity extends Activity {

private WebView mWebView;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);

mWebView = (WebView)findViewById(R.id.mWebView);

mWebView.getSettings().setJavaScriptEnabled(true);

mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.setInitialScale(100);
mWebView.loadUrl("http://www.yespia.net/");

mWebView.setWebViewClient(new WebViewClientClass());

}



activity_webview.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mWebView" />


</LinearLayout>


Posted by yespia.net piacom