'JAVA'에 해당되는 글 61건
- 2024.09.10 :: 서비스 ForegroundService , BackgroundService
- 2024.09.10 :: 핸들러 , Handler 1
- 2024.06.29 :: WiFiManagerTest
- 2024.03.26 :: ListView 의 아이템으로 두가지 이상의 View사용하기
- 2024.03.14 :: 안드로이드 벡터 패스(Vector Path) 그리기
- 2024.03.14 :: Listview의 글자 크기 변경
- 서비스 사용 예제
https://stickode.tistory.com/736
[Android][Java] Service 사용 이해를 위한 예제(1)
오늘은 간단한 예제를 통해 안드로이드 서비스의 동작 방식을 익혀 보도록 하겠습니다. Service ? 백그라운드에서 오랜 작업을 수행할 수 있는 앱 구성요소로써 사용자 인터페이스가 제공되지 않
stickode.tistory.com
'JAVA > android_studio' 카테고리의 다른 글
| add an item to a ListView with each button click (0) | 2024.09.16 |
|---|---|
| JAVA, TimeFormat string , [Java/Android] 현재 날짜, 시간 출력 SimpleDateFormat (0) | 2024.09.16 |
| 핸들러 , Handler (1) | 2024.09.10 |
| WiFiManagerTest (0) | 2024.06.29 |
| ListView 의 아이템으로 두가지 이상의 View사용하기 (0) | 2024.03.26 |
- 핸들러 , Handler
https://junyoung-developer.tistory.com/116
[Android] 핸들러(Handler)
모든 내용은 Do it! 안드로이드 앱 프로그래밍을 바탕으로 정리한 것입니다. 핸들러(Handler) 새로운 프로젝트를 만들면 자동으로 생성되는 메인 액티비티는 앱이 실행될 때 하나의 프로세스에서
junyoung-developer.tistory.com
- https://brunch.co.kr/@mystoryg/84
안드로이드 Handler 알고 쓰자
Message Queue & Looper | 안드로이드 개발자라면 UI 작업은 별도의 스레드(이하 워커 스레드(worker thread))가 아닌 메인 스레드(main thread)에서 해야 한다는 이야기를 들어봤을 것이다. 만약 로직상 워커
brunch.co.kr
[Android] 스레드와 핸들러
https://survivalcoding.com/p/android_basic 될 때까지 안드로이드 될 때까지 안드로이드에 수록된 예제의 라이브 코딩 해설 survivalcoding.com 위 서적을 참고하였습니다. 이번 시간에는 비동기 처리의 대표적
50billion-dollars.tistory.com
[안드로이드] 스레드(Thread)와 핸들러(Handler)
스레드(Thread)란 동시 작업을 위한 하나의 실행 단위입니다.앱을 실행하면 메인 스레드라는 하나의 스레드가 시작되는데이 메인 스레드는 앱의 기본 실행을 담당합니다.만약 사용자가 필요에 따
velog.io
* google search about Handler
🔎 안드로이드 자바, 핸들러 : Google 검색
www.google.com
- Bundle
https://lamlic36.tistory.com/17
안드로이드 번들(Bundle)
액티비티 간 데이터 송수신 예제(추후 보완 수정 작업 예정) 간단 설명 - 두개의 액티비티 사이에 번들을 통해 데이터 송수신 예제 - 본 페이지에선 Bundle 내에 문자열, 정수, 문자열 배열, 정수 배
lamlic36.tistory.com
[개념] 안드로이드 Bundle(번들)로 Data 전달
1. Bundle의 개념 2. Bundle의 활용
velog.io
'JAVA > android_studio' 카테고리의 다른 글
| JAVA, TimeFormat string , [Java/Android] 현재 날짜, 시간 출력 SimpleDateFormat (0) | 2024.09.16 |
|---|---|
| 서비스 ForegroundService , BackgroundService (0) | 2024.09.10 |
| WiFiManagerTest (0) | 2024.06.29 |
| ListView 의 아이템으로 두가지 이상의 View사용하기 (0) | 2024.03.26 |
| 안드로이드 벡터 패스(Vector Path) 그리기 (0) | 2024.03.14 |
WiFiManagerTest
안드로이드 버젼 7.0 지원하기 위한 버젼임.
- MainActivity.java
> OnCreate()에서 BroadcastReceiver 등록
> 퍼미션 요청 , ACCESS_FINE_LOCATION
> onResume 에서 BroadcastReceiver 등록
> onPause 에서 BroadcastReceiver 해제
| public class MainActivity extends AppCompatActivity { private WifiManager wifiManager; private List<ScanResult> scanDatas; // ScanResult List final private BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { if (ActivityCompat.checkSelfPermission( context.getApplicationContext() , android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } scanDatas = wifiManager.getScanResults(); Toast.makeText(context.getApplicationContext(), scanDatas.get(0).SSID, Toast.LENGTH_SHORT).show(); }else if(action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) { //sendBroadcast(new Intent("wifi.ON_NETWORK_STATE_CHANGED")); //error context.sendBroadcast(new Intent("wifi.ON_NETWORK_STATE_CHANGED")); } } }; //API Level 30 // WifiManager.ScanResultsCallback callback = new WifiManager.ScanResultsCallback() { // @Override // public void onScanResultsAvailable() { // // Handle scan results here // // } // }; // Executor executor ; // @RequiresApi(api = Build.VERSION_CODES.R) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String[] PERMS_INITIAL={ // Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION , }; ActivityCompat.requestPermissions(this, PERMS_INITIAL, 127); Button buttonScan = (Button) findViewById( R.id.btnStartScan) ; buttonScan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { wifiManager.startScan() ; Log.d("WiFiManager" , "startScan() called--") ; } }); //The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing `getSystemService` to `getApplicationContext().getSystemService` wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); //wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); if(!wifiManager.isWifiEnabled()){ wifiManager.setWifiEnabled(true); } } @Override protected void onResume() { super.onResume(); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ // N=24, Android7.0 , // Do something for lollipop and above versions //{{ IntentFilter intentFilter = new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) ; intentFilter.addAction( WifiManager.NETWORK_STATE_CHANGED_ACTION); registerReceiver( receiver , intentFilter) ; //}} } else{ // do something for phones running an SDK before lollipop Log.d("AndroidVersion" , "Version is below : " + android.os.Build.VERSION.SDK_INT) ; } } @Override protected void onPause() { super.onPause(); unregisterReceiver( receiver ); } } |
- AndroidManifest.xml
> WiFi연결시 아래의 permission을 추가해줘야 함.
| <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> |
- build.gradle(:app)
> WiFiManagerTest\app\ 폴더에 있음.
>minSdk, targetSdk 를 24로 설정후 에러가 없을려면
> dependencies 에서 material의 버젼을 1.5.0으로 설정해야함.
>> implementation 'com.google.android.material:material:1.5.0'
| plugins { id 'com.android.application' } android { compileSdk 33 defaultConfig { applicationId "com.example.wifimanagertest" minSdk 24 targetSdk 24 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } |
'JAVA > android_studio' 카테고리의 다른 글
| 서비스 ForegroundService , BackgroundService (0) | 2024.09.10 |
|---|---|
| 핸들러 , Handler (1) | 2024.09.10 |
| ListView 의 아이템으로 두가지 이상의 View사용하기 (0) | 2024.03.26 |
| 안드로이드 벡터 패스(Vector Path) 그리기 (0) | 2024.03.14 |
| Listview의 글자 크기 변경 (0) | 2024.03.14 |
- 아래와 같이 ListView 레이아웃 정의할때 listitem으로 별도의 레이아웃파일을 지정해야함.
tools:listitem="@layout/row_item">
</ListView>

https://recipes4dev.tistory.com/57
안드로이드 리스트뷰에 여러 종류의 아이템뷰 사용하기. (Android ListView with Multi Item)
1. 아이템이 다른 ListView 지금까지 안드로이드 ListView와 관련하여 기본 사용법, 커스텀 아이템, 속성, 아이템 다루기 등 몇 가지 주제들에 대해 살펴보았습니다. 여기까지 살펴본 내용 만으로도
recipes4dev.tistory.com
'JAVA > android_studio' 카테고리의 다른 글
| 핸들러 , Handler (1) | 2024.09.10 |
|---|---|
| WiFiManagerTest (0) | 2024.06.29 |
| 안드로이드 벡터 패스(Vector Path) 그리기 (0) | 2024.03.14 |
| Listview의 글자 크기 변경 (0) | 2024.03.14 |
| Bluetooth search (0) | 2024.02.18 |
https://www.charlezz.com/?p=1110
안드로이드 VectorDrawable 알아보기 | 찰스의 안드로이드
VectorDrawable 이전 포스트에서 Vector 이미지 포맷을 이용했을때의 장단점에 대해서 알아보았습니다. 이번 시간은 안드로이드 리소스인 VectorDrawable에 대해서 알아보도록 하겠습니다. xml 파일에서
www.charlezz.com
'JAVA > android_studio' 카테고리의 다른 글
| WiFiManagerTest (0) | 2024.06.29 |
|---|---|
| ListView 의 아이템으로 두가지 이상의 View사용하기 (0) | 2024.03.26 |
| Listview의 글자 크기 변경 (0) | 2024.03.14 |
| Bluetooth search (0) | 2024.02.18 |
| +-> Fragment , getActivity() (0) | 2023.10.15 |
https://stackoverflow.com/questions/20456393/how-to-change-text-size-of-listview
how to change text size of listview
I am using List Activity to retrieve data from SQLITE. But I can not set the font size of list view. Please help me. public class CartList extends ListActivity { private ArrayList<String>
stackoverflow.com
- source code :
Go into layout folder and create a new xml file named mytextview.xml(whatever you want to name it)
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:paddingTop="2dip"
android:paddingBottom="3dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12dp" />
in the code
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, results));
change it to
setListAdapter(new ArrayAdapter<String>(this,
R.layout.mytextview, results));
'JAVA > android_studio' 카테고리의 다른 글
| ListView 의 아이템으로 두가지 이상의 View사용하기 (0) | 2024.03.26 |
|---|---|
| 안드로이드 벡터 패스(Vector Path) 그리기 (0) | 2024.03.14 |
| Bluetooth search (0) | 2024.02.18 |
| +-> Fragment , getActivity() (0) | 2023.10.15 |
| +-> ListView 사용하기 , RecyclerView (0) | 2023.10.15 |
