•  


platform-samples/samples/user-interface/appwidgets at main · android/platform-samples · GitHub
Skip to content

Latest commit

 

History

History

appwidgets

Folders and files

Name Name
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

AppWidgets samples

This module demonstrates how to build Android AppWidgets with:

The new set of APIs allows an application to build more engaging and beautiful widgets. Use this sample together with the App widget guides .

Pre-requisites

  • Android 12 (API level 31)
  • Android Studio Chipmunk or newer

Getting Started

The sample contains 3 type of widgets:

  • ToDo list: showcasing how to create a list of items
  • Buttons: showcasing how to use the new CompoundedButtons and handle click events
  • Weather: showcasing a "real-life" weather widget.

Those are implemented in two packages:

  • rv for RemoteViews implementation
  • glance for Glance implementation

In addition, the AppWidgets.kt showcases how to request the launcher to "pin" an appwidget.

TODO widget showcase Weather widget showcase Images widget showcase

More showcasing resources in the screenshots folder

Run a new configuration

When creating a new run configuration, it's important to ensure that the widget is recreated without launching a new activity. Follow these steps to do so:

  1. In Android Studio, select Run > Edit Configurations .
  2. In the Run/Debug Configurations dialog, select Always install with package manager... .
  3. Under Launch Options , in the Launch menu, select Nothing .

This will ensure that the widget is recreated but no activity is launched.

screenshot showing run configuration in Android Studio for widgets

Support

If you've found an error in this sample, please file an issue at https://github.com/android/user-interface .

For API-related issues, please file any bugs using the following links:

License

Copyright 2023 The Android Open Source Project
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본