๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ’ปTech160

[์•ˆ๋“œ๋กœ์ด๋“œ] ์ „ํ™” ๋ฐ”๋กœ ๊ฑธ๊ธฐ ์›ํ•˜๋Š” ๋ฒˆํ˜ธ๋กœ ๋ฐ”๋กœ ํ†ตํ™” ๊ฑฐ๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. AndroidManifest.xml ์ž๋ฐ”์ฝ”๋“œ String telNo = "010-0000-0000"; Intent call = new Intent(Intent.ACTION_CALL, Uri.parse("tel:/" + telNo)); startActivity(call); 2015. 9. 16.
[Java] ๊ณ„์‚ฐ๊ธฐ ์†Œ์Šค (๊ด„ํ˜ธ, ์‚ฌ์น™์—ฐ์‚ฐ ์šฐ์„ ์ˆœ์œ„) ๊ด„ํ˜ธ, ์‚ฌ์น™์—ฐ์‚ฐ ์šฐ์„ ์ˆœ์œ„ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ณ„์‚ฐ๊ธฐ ์†Œ์Šค ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค. ํ›„์œ„ํ‘œ๊ธฐ๋ฒ•๊ณผ Stack ๊ธฐ๋ฐ˜์œผ๋กœ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์™„๋ฒฝํ•˜๊ฒŒ ์˜ˆ์™ธ์ฒ˜๋ฆฌ ๋œ ๋ถ€๋ถ„์ด ์•„๋‹ˆ๋ผ ์ฐธ๊ณ ํ•˜์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค. package test; import java.util.ArrayList; import java.util.Stack; /** * ๊ณ„์‚ฐ ์„œ๋น„์Šค * * @author * @version * @since * @created 2015. 1. 12. */ public class CalculatorService { public static void main(String[] args) { String result = getCalculate("(10 + 20) * 10"); System.out.println(result); } /** * ๊ณ„์‚ฐ์ฒ˜๋ฆฌ */ pr.. 2015. 9. 16.
[Java] ๊ฐ„๋‹จํ•˜๊ฒŒ List ๋žœ๋ค์œผ๋กœ ์ •๋ ฌํ•˜๋Š” ๋ฐฉ๋ฒ• List list = new ArrayList(); list.add("1"); list.add("2"); list.add("3"); list.add("4"); list.add("5"); Collections.shuffle(list); // num ๊ฐ’๋“ค ๋žœ๋ค์œผ๋กœ ์ˆœ์„œ ์žฌ๋ฐฐ์น˜ for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } 2015. 9. 16.
[์•ˆ๋“œ๋กœ์ด๋“œ] ๊ฐ„๋‹จํ•œ AlertDialog ์‚ฌ์šฉ๋ฐฉ๋ฒ• ์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์ œ๊ณตํ•˜๋Š” AlertDialog ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ฐ„๋‹จํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜์—ฌ alert์ฐฝ๊ณผ confirm์ฐฝ์— ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ“ˆ Alert์ฐฝ ์ ์šฉ AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Error"); alert.setMessage("์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒ ํ•˜์˜€์Šต๋‹ˆ๋‹ค."); alert.setPositiveButton("ํ™•์ธ", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert.show(); ๐Ÿ“‰ Confirm์ฐฝ ์ ์šฉ AlertDialog.Builder alert = ne.. 2015. 9. 16.
[Java] ๊ฐ„๋‹จํ•˜๊ฒŒ ๋ฆฌ์ŠคํŠธ ์ค‘๋ณต ์ œ๊ฑฐ ๋ฐ ์ •๋ ฌ List์—์„œ HashSet์„ ์‚ฌ์šฉํ•˜์—ฌ ์ค‘๋ณต๋œ ๋‚ด์šฉ์„ ์ œ๊ฑฐ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. HashSet ๋ฐ์ดํ„ฐ ์ €์žฅ ์ˆœ์„œ ๋žœ๋ค LinkedHashSet ๋ณด๋‹ค ์„ฑ๋Šฅ, ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ์— ์œ ๋ฆฌ LinkedHashSet ๋ฐ์ดํ„ฐ ์ €์žฅ ์ˆœ์„œ ๋ณด์žฅ (์ถ”๊ฐ€ ์ˆœ์„œ๋Œ€๋กœ ์ €์žฅ) public static void main(String[] args) { List list = new ArrayList(); list.add("1"); list.add("1"); list.add("2"); list.add("2"); list.add("3"); list.add("4"); list.add("5"); //์ค‘๋ณต๋œ ๋‚ด์šฉ ์ œ๊ฑฐ List duplicateRemoveList = new ArrayList(new LinkedHashSet(list)); for (int i =.. 2015. 9. 15.
[์•ˆ๋“œ๋กœ์ด๋“œ] LGํฐ ์†Œํ”„ํŠธํ‚ค ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ• ์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœํ•  ๋•Œ Lgํฐ์— ์†Œํ”„ํŠธํ‚ค๋ฅผ ์œ ๋ฌด๋ฅผ ํ™•์ธํ•ด์•ผ ํ•  ๊ฒฝ์šฐ๊ฐ€ ์ข…์ข… ์žˆ๋Š”๋ฐ์š”. ๊ฐ„๋‹จํ•˜๊ฒŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค. /** * Lg ํฐ ์ผ ๊ฒฝ์šฐ Dp ๊ฐ’ ์กฐ์ • */ private void checkLgPhone() { //๋ฉ”๋‰ด๋ฒ„ํŠผ ์œ ๋ฌด boolean hasMenuKey = ViewConfiguration.get(getApplicationContext()).hasPermanentMenuKey(); //๋’ค๋กœ๊ฐ€๊ธฐ ๋ฒ„ํŠผ ์œ ๋ฌด boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK); if (!hasMenuKey && !hasBackKey) { // lgํฐ ์†Œํ”„ํŠธํ‚ค์ผ ๊ฒฝ์šฐ Log.i("phoneType", "LGphone"); }.. 2015. 9. 15.
[์•ˆ๋“œ๋กœ์ด๋“œ] ๊ฐ„๋‹จํ•˜๊ณ  ์‰ฌ์šด ๋‹ฌ๋ ฅ ์†Œ์Šค(GridView) GridView๋กœ ๊ฐ„๋‹จํ•œ ๋‹ฌ๋ ฅ์„ ๋งŒ๋“ค์–ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. 1. ๋ ˆ์ด์•„์›ƒ ์ƒ์„ฑ -ํ˜„์žฌ ์—ฐ/์›”์„ ๋ณด์—ฌ์ค„ ํ…์ŠคํŠธ๋ทฐ์™€ Calendar๋ฅผ ์ž‘์„ฑํ•  ๊ทธ๋ฆฌ๋“œ๋ทฐ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. res->layout activity_calendar.xml (@color/color_ffffff๋ฅผ ์‚ฌ์šฉํ•˜์‹œ๋ ค๋ฉด color.xml์— ์ž‘์—…ํ•ด์ฃผ์„ธ์š”.) item_calendar_gridview.xml 2. ์ž๋ฐ”์ฝ”๋“œ ์ž‘์„ฑ CalendarActivity.java package com.example.calendar; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; imp.. 2015. 9. 15.
[์•ˆ๋“œ๋กœ์ด๋“œ] ์›ํ˜• ํ”„๋กœ๊ทธ๋ ˆ์Šค๋ฐ” ์‚ฌ์šฉ๋ฒ• ๋ฐ ๊ทธ๋ผ๋ฐ์ด์…˜ ์ ์šฉ ์›ํ˜• ํ”„๋กœ๊ทธ๋ ˆ์Šค๋ฐ” ์‚ฌ์šฉ๋ฒ•๊ณผ ๊ทธ๋ผ๋ฐ์ด์…˜ ํšจ๊ณผ ์ ์šฉ ๋ฐ ์ปฌ๋Ÿฌ ๋ณ€๊ฒฝ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ์ œ๊ฐ€ ์‚ฌ์šฉํ•œ ๋ฐฉ๋ฒ•์€ ์›ํ˜• ํ”„๋กœ๊ทธ๋ ˆ์Šค๋ฐ”๋ฅผ RelativeLayout์œผ๋กœ ๋‘ ํ”„๋กœ๊ทธ๋ ˆ์Šค๋ฐ”๋ฅผ ๊ฒน์ณ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. ์šฐ์„  res -> drawable์— 2๊ฐ€์ง€ xml์„ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. android:startColor, android:endColor, android:centerColo๋กœ ๊ทธ๋ผ๋ฐ์ด์…˜ ํšจ๊ณผ๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค ๊ทธ ๋‹ค์Œ res -> layout ํด๋”์— xml ํŒŒ์ผ ํ•˜๋‚˜๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. [๊ฒฐ๊ณผ ํ™”๋ฉด] 2015. 9. 14.