JAVA/android_studio 2024. 9. 16. 11:19

 

 

private void scrollListViewToBottom() {
        listView.setSelection(adapter.getCount() - 1);
}

 

-

https://stackoverflow.com/questions/46290105/android-listview-scroll-to-bottom

 

Android ListView scroll to bottom

I am developing app with chat and I want my ListView to scroll to bottom when new message been posted by user and when user was at the bottom of the list and there are new messages recieved. I am u...

stackoverflow.com

 

 

-

https://www.google.com/search?q=android+java%2C++listview+automatic+scrolldown&newwindow=1&client=firefox-b-d&sca_esv=d20da4baa90e25a0&sca_upv=1&sxsrf=ADLYWIKOk3VPLcPF-ZMEw-8IV8pv9retOg%3A1726414992625&ei=kADnZsbuJbun2roP89S3iAc&ved=0ahUKEwjG9vqCpcWIAxW7k1YBHXPqDXEQ4dUDCA8&uact=5&oq=android+java%2C++listview+automatic+scrolldown&gs_lp=Egxnd3Mtd2l6LXNlcnAiLGFuZHJvaWQgamF2YSwgIGxpc3R2aWV3IGF1dG9tYXRpYyBzY3JvbGxkb3duMgoQIRigARjDBBgKSK8hUJwNWIggcAF4AZABAJgBsAGgAeMRqgEEMC4xNbgBA8gBAPgBAZgCDKAClQ3CAgoQABiwAxjWBBhHwgIIEAAYgAQYogTCAgQQIRgKmAMA4gMFEgExIECIBgGQBgiSBwQxLjExoAeOQg&sclient=gws-wiz-serp

 

🔎 android java, listview automatic scrolldown: Google 검색

 

www.google.com

 

posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:18

https://armful-log.tistory.com/26

 

[안드로이드] ListView, ArrayAdapter 사용하기

안드로이드 개발을 하다보면, 스크롤이 되면서 아이템들을 리스트로 보여줘야할 상황이 있다.이것을 우리는 Adapter를 이용해서 data들을 가져오는 ListView를 사용할 것이다. ArrayAdapter- ArrayList(data)

armful-log.tistory.com

 

 

 

posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:16

 

https://stackoverflow.com/questions/51357772/android-service-not-restarted-when-app-back-from-idle-state

 

Android service not restarted when app back from idle state

I've upgraded my app to API 26 and I'm facing some issues with the new background execution limits. On Oreo devices, as soon as my app goes in background, my app is stopped by the OS due to idle s...

stackoverflow.com

 

서비스 실행후 서비스포그라운드 를 제한시간이내에 호출해줘야 함. 

posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:11

 

https://stackoverflow.com/questions/52382710/permission-denial-startforeground-requires-android-permission-foreground-servic

 

Permission Denial: startForeground requires android.permission.FOREGROUND_SERVICE

Lately we have suddenly been seeing a few of the following stack traces. Why could that be? This is from when the app tries to move an audio commentary service into the foreground with a media

stackoverflow.com

 

From the migration notes for Android 9:

Apps wanting to use foreground services must now request the FOREGROUND_SERVICE permission first. This is a normal permission, so the system automatically grants it to the requesting app. Starting a foreground service without the permission throws a SecurityException.

The solution is to just add the following in AndroidManifest.xml:

<manifest ...>
     ...
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
     ...
     <application ...>
     ...
</manifest>
posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:09

 

https://stackoverflow.com/questions/31279216/how-to-add-an-item-to-a-listview-with-each-button-click

 

How to add an item to a ListView with each Button click

This is the code I'm working on, it should simply add an item in a ListView (w/ array) each time the Button is clicked. The text inserted by the user on a EditText should be added to the list each ...

stackoverflow.com

 

Button buttonPlus = (Button)findViewById(R.id.buttonPlus);

        buttonPlus.setOnClickListener(
                new Button.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        arrayNames.add(0, namesText.getText().toString());
                        adapterNames.notifyDataSetChanged();
                        namesText.setText("");

                    }
                }
        );

 

 

 

posted by cskimair
:
JAVA/android_studio 2024. 9. 16. 11:03

 

[Java/Android] 현재 날짜, 시간 출력 SimpleDateFormat

출처: https://kong-droid.com/entry/AndroidJava-현재-날짜-시간-출력-SimpleDateFormat [Kong-droid:티스토리]

- 사용예.

 

SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS") ;//밀리초 단위로 표시
String time = sdf.format (System.currentTimeMillis());

adapter.add( time +"]" + message) ;
adapter.notifyDataSetChanged();

posted by cskimair
: