草庐IT

activity-state

全部标签

android - 谷歌播放服务 : how to check if there is currently "active" pending intent callback registered to location updates/activity recognition?

我的应用程序在后台执行定期位置更新和Activity识别检测。我正在使用GooglePlayServicesAPI这样做:例如-要注册到位置更新,我提供接收更新的未决Intent:mLocationClient.requestLocationUpdates(mLocationRequest,pendingInent);要注销位置更新,我正在执行以下操作:mLocationClient.removeLocationUpdates(pendingInent);这很好,而且效果很好。但是我如何才能知道当前是否有一个pendingIntent持有我的应用程序组件的Intent当前是否已在Goo

android - 如何在不显示父 Activity 的情况下用另一个全屏对话框 fragment 替换?

我有一个使用单个自定义DialogFragment类的Activity。它的外观是数据驱动的,因此每次调用看起来都大不相同。它是“全屏”,即setStyle(DialogFragment.STYLE_NO_FRAME,android.R.style.Theme);作为对网络调用结果的响应,我dismiss()当前显示的实例(如果有的话)并show()一个新实例:finalCustomDialogFragmentdialog=(CustomDialogFragment)getSupportFragmentManager().findFragmentByTag(DIALOG_TAG_CUS

android - 将监听器放在 Activity 之间的过渡动​​画上

在android中,是否可以在Activity之间的动画上放置一个监听器,以便可以在动画结束时执行代码? 最佳答案 试试这个Transitiontransition=getWindow().getSharedElementEnterTransition();transition.addTarget(android.R.transition.slide_top);transition.addListener(newTransition.TransitionListener(){@OverridepublicvoidonTransiti

服务器报错解决:CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate‘.T

    在一个新的服务器端口创建完虚拟环境后,显示报错信息CommandNotFoundError:Yourshellhasnotbeenproperlyconfiguredtouse'condaactivate'.Toinitializeyourshell,run$condainitCurrentlysupportedshellsare:-bash-fish-tcsh-xonsh-zsh-powershellSee'condainit--help'formoreinformationandoptions.IMPORTANT:Youmayneedtocloseandrestartyourshe

android - Activity 识别继续在奥利奥服务

到目前为止,我正在为这个问题伤脑筋,但没有解决方案。我看到许多指南如何完成此操作(Documentation、Tutorial)并成功在Android7中实现。我设法做到的是当用户Activity发生变化时成功获得在后台运行的服务通知。我的应用程序完美运行。问题出在安卓8和谷歌电池管理上。我的服务总是被杀死。所以...我已经尝试克服这个问题:向用户解释如何为我的应用禁用电池优化,这样它就不会终止我的服务。问题是它对于cummon用户来说太复杂了。添加uses-permissionandroid:name="android.permission.REQUEST_IGNORE_BATTER

android - session 'app' : Error Launching activity in Android Studio 3. 1.3

我该如何解决这个错误。MainActivity类已经在我的项目中。这是一个screenshot错误的我试过这个link,但它对我不起作用 最佳答案 我也遇到了这个错误。对我来说,将调试版本的minifyEnabled设置为false很有帮助。在CleanBuild之后它再次启动。 关于android-session'app':ErrorLaunchingactivityinAndroidStudio3.1.3,我们在StackOverflow上找到一个类似的问题:

android - Activity 无法转换为 LifecycleOwner

我想将Room与LiveData一起使用,在其他项目中我已经使用过它,但在这个项目中,我无法让它工作。当我尝试观察实时数据时,它无法将我的Activity转换为生命周期Activity,但是,我正在使用AppCompatActivity,我什至尝试覆盖getLifecycle方法(在以前的项目中对我有用)。我什至尝试使用AndroidX,但仍然是同样的问题:(这是我的Activity(部分):importandroidx.appcompat.app.AppCompatActivity;importandroidx.lifecycle.Lifecycle;importandroidx.l

android - 为什么从导航组件版本 1.0.0-alpha09 中删除了 addDefaultArguments()?从 Activity 将 arg 传递给 StartDestination 的 WorkAround 是什么?

你好,我正在研究导航架构组件,我正在以编程方式为我的Activity设置NavHostFragment。MainActivity.xml:MainActiviy.kt:packagecom.andor.navigate.demonavigationimportandroid.os.Bundleimportandroid.support.v7.app.AppCompatActivityimportandroidx.navigation.Navigationimportandroidx.navigation.fragment.NavHostFragmentimportandroidx.na

android - 应用程序退出而不是进入下一个 Activity

我通过一个简单的Intent调用一个Activity:IntentstartNewActivityOpen2=newIntent(this,TransitionLandscape.class);if(extras!=null){if(!extras.isEmpty()){startNewActivityOpen2.putExtras(extras);}}startActivity(startNewActivityOpen2);当前Activity也是TransistionLandscape.class重要吗?当我开始新Activity时,应用程序退出(没有崩溃)。通过调试器,永远不会调

android - 通过取消绑定(bind)所有有界 Activity 来停止服务

我有一个已启动且有界的服务(音乐播放器),我想在单击通知的关闭按钮时停止它。但是,如果有Activity绑定(bind)到该服务,则该服务不会停止。单击按钮时如何停止服务?我已经尝试收集服务中的Activity列表并调用它们的回调以解除绑定(bind)(实际上finish()然后在onStop()上调用unbind())然后我通过调用停止服务stopSelf()但我认为这不是一个好主意,因为生命周期问题和一些Activity被多次添加并维护名单很难。应该有更好的方法!尽管搜索了几个小时后我什么也没找到。这是我的PlayerService的onStartCommand()override