1. Download facebook android api.
2. Extract the downloaded file to a proper folder.
3. Make Android application project using facebook folder.
4. Import sample project Hackbook using existing projects into workspace. Do not use existing android code into workspace.
5. Add facebook library to project.
6. Fix project properties
2013년 2월 28일 목요일
2013년 2월 27일 수요일
how to deal char
1. get char code: cast (int) for char
char = 'ㅎ';
int charCode = (int) char;
2. compare two chars:
char char1='ㄹ';
char char2='ㅌ';
if(char == char2) //do something
3. 'ㅎ' is not same as ininial sound 'ㅎ' of '하나';
char = 'ㅎ';
int charCode = (int) char;
2. compare two chars:
char char1='ㄹ';
char char2='ㅌ';
if(char == char2) //do something
3. 'ㅎ' is not same as ininial sound 'ㅎ' of '하나';
get initial sound of Korean String
private char getChosung(String s) {
// typo스트링의 글자수 만큼 list에 담아둡니다.
for (int i = 0; i < s.length(); i++) {
char comVal = (char) (s.charAt(i) - 0xAC00);
if (comVal >= 0 && comVal <= 11172) {
// 한글일경우
// 초성만 입력 했을 시엔 초성은 무시해서 List에 추가합니다.
char uniVal = (char) comVal;
// 유니코드 표에 맞추어 초성 중성 종성을 분리합니다..
char cho = (char) ((((uniVal - (uniVal % 28)) / 28) / 21) + 0x1100);
if (cho != 4519) {
return cho;
}
} else {
return 'ㄱ';
}
}
return 'ㄱ';
}
if animation and scrolllistener collide
add scrolllistener when animation is finished(onAnimationEnd method).
2013년 2월 26일 화요일
get city name without open api
private void getCityName(double mLat, double mLong) {
String result = null;
Geocoder mGeoCoder = new Geocoder(this, Locale.KOREA);
try {
List<Address> addrs = mGeoCoder.getFromLocation(mLat, mLong, 1);
Address address = addrs.get(0);
result = address.getLocality();
} catch (IOException e) {
}
Toast.makeText(this, result, Toast.LENGTH_LONG).show();
}
slide up animation when start activity
Intent intent = new Intent(this, LoginActivity.class);
ActivityOptions options = ActivityOptions.makeCustomAnimation(this,
R.animator.slide_up, R.animator.fade_in);
startActivity(intent, options.toBundle());
-------slide_up.xml-------------------
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="100%"
android:toYDelta="0%" />
---------fade_in.xml----------------------
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="1.0"
android:toAlpha="0.9"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
!! If put 0 in the place of "R.animator.fade_in" in ActivityOptions.makeCustomAnimation method, the background activity will turn black.
android how to resize layout when softkeyboard goes up
<activity
android:name="com.example.keyboardviewtest2.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar"
android:windowSoftInputMode="adjustResize"
>
get shared preference from other app
App 1:
Context otherAppsContext = null;
try {
otherAppsContext = createPackageContext(
"com.example.sharedpreferencehosttest",
Context.CONTEXT_IGNORE_SECURITY);
} catch (NameNotFoundException e) {
}
SharedPreferences.Editor editor = otherAppsContext
.getSharedPreferences(
"PREFS_FILE",
Context.CONTEXT_IGNORE_SECURITY).edit();
editor.putString("sharedpreferencehosttest", "sogi");
editor.commit();
App 2:
Context otherAppsContext = null;
try {
otherAppsContext = createPackageContext(
"com.example.sharedpreferencehosttest",
Context.CONTEXT_IGNORE_SECURITY);
} catch (NameNotFoundException e) {
}
SharedPreferences sharedPreferences = otherAppsContext
.getSharedPreferences("PREFS_FILE", Context.CONTEXT_IGNORE_SECURITY);
Toast.makeText(
this,
sharedPreferences.getString("sharedpreferencehosttest",
"can not get value"), Toast.LENGTH_LONG).show();
Context otherAppsContext = null;
try {
otherAppsContext = createPackageContext(
"com.example.sharedpreferencehosttest",
Context.CONTEXT_IGNORE_SECURITY);
} catch (NameNotFoundException e) {
}
SharedPreferences.Editor editor = otherAppsContext
.getSharedPreferences(
"PREFS_FILE",
Context.CONTEXT_IGNORE_SECURITY).edit();
editor.putString("sharedpreferencehosttest", "sogi");
editor.commit();
App 2:
Context otherAppsContext = null;
try {
otherAppsContext = createPackageContext(
"com.example.sharedpreferencehosttest",
Context.CONTEXT_IGNORE_SECURITY);
} catch (NameNotFoundException e) {
}
SharedPreferences sharedPreferences = otherAppsContext
.getSharedPreferences("PREFS_FILE", Context.CONTEXT_IGNORE_SECURITY);
Toast.makeText(
this,
sharedPreferences.getString("sharedpreferencehosttest",
"can not get value"), Toast.LENGTH_LONG).show();
2013년 2월 25일 월요일
android webview detect scroll
make custom webview class extending webview, and override onscrollchanged method.
webview loadurl open in a browser??
webView.setWebViewClient(new WebViewClient(){
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return (false);
}
});
ObjectAnimation ran just one time
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
v.setRotationY(0);
}
});
2013년 2월 24일 일요일
listview adapter.remove unsupportedoperationexception
Check if you use string array, not arraylist. String array doesn't have remove() method, so when you try to use remove() method, it gives UnsupportedOperationException. So change string array to arraylist.
String[] array = {"a","b","c","d","e","f","g"};
ArrayList<String> lst = new ArrayList<String>();
lst.addAll(Arrays.asList(array));
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, lst);
2013년 2월 22일 금요일
ERROR_NOT_MARKET_MANAGED
Wait for your app to show up on Google Play market after you published it. Once it appears on market, maybe after several hours, you will get "Licensed" response.
2013년 2월 21일 목요일
if downloading android full source keeps fails
use the following two command instead of "repo sync".
$ sudo sysctl -w net.ipv4.tcp_window_scaling=0
$ repo sync -j1
2013년 2월 20일 수요일
2013년 2월 19일 화요일
how to get app installed date
long installed = context.getPackageManager().getPackageInfo("package.name", 0).firstInstallTime;
listview layout_weight not working
Check if layout_width of ListView tag is not "wrap_content".
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
2013년 2월 17일 일요일
how to download android full source 4
I am downloading android full source now following the steps on the android website.
http://source.android.com/source/downloading.html
At first, it didn't work. So I moved to the root folder and refollowed the steps. And It W
ORKED!!!
http://source.android.com/source/downloading.html
At first, it didn't work. So I moved to the root folder and refollowed the steps. And It W
ORKED!!!
how to download android full source 3 - jdk, curl, python, and git
To download android full source, four programs should be installed in advance: cUrl, Python, Git, Jdk. Python is already installed on Ubuntu 12.04 Lts. So I had to install cUrl, Git, and Jdk. It is easy to install cUrl and Git. I just had to type "sudo apt-get install curl" and "sudo apt-get install git" on terminal prompt.
I installed Oracle Sun Java jdk, not openjdk. I heared that sun jdk is better than openjdk. I installed jdk referencing the following blog.
http://www.printandweb.ca/2012/04/manually-install-oracle-jdk-6-for.html
I installed Oracle Sun Java jdk, not openjdk. I heared that sun jdk is better than openjdk. I installed jdk referencing the following blog.
http://www.printandweb.ca/2012/04/manually-install-oracle-jdk-6-for.html
how to download android full source 2 - language input on Ubuntu
After installed Ubuntu, an error message about language, Korean, showed up. I installed necessary packages about it. But I couldn't input Korean. I restarted Ubuntu and added Korean input on IBus setting. Then I could enter Korean.
I can change language input pressing Ctrl and Space together.
I can change language input pressing Ctrl and Space together.
how to download android full source 1 - ubuntu
Android full source can be downloaded on Mac os or Linux, not Window. I use Window 7 like many guys.So I installed Ubuntu 12.04 lts, the popular linux version using Wubi, Ubuntu window installer. I chose 12.04 lts version because it is stable.
Ubuntu download url: http://www.ubuntu.com/download
Ubuntu download url: http://www.ubuntu.com/download
피드 구독하기:
글 (Atom)