android – 在新的应用程序版本中更改启动器活动名称
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了android – 在新的应用程序版本中更改启动器活动名称,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2417字,纯文字阅读大概需要4分钟。
内容图文
我已经开发了一个新版本的应用程序,我已经更改了已启动的活动的名称.
在升级之前,清单中有:
<activity
android:name=".Splash"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
然后我只更改了活动的名称和包,现在它是:
<activity
android:name=".view.SplashActivity"
... >
...
</activity>
发生的事情是,人们从市场上下载应用程序后,启动程序不会刷新,它仍然会调用旧活动路径.
你知道怎么解决这个问题吗?
解决方法:
它说,
A subtle but important aspect of what constitutes a break in compatibility is the android:name attribute of your activity, service, and receiver components. This can be surprising because we think of android:name as pointing to the private code implementing our application, but it is also (in combination with the manifest package name) the official unique public name for that component, as represented by the ComponentName class.
Changing the component name inside of an application can have negative consequences for your users. Some examples are:
- If the name of a main activity of your application is changed, any shortcuts the user made to it will no longer work. A shortcut is an Intent that directly specifies the ComponentName it should run.
- If the name of a service implementing a Live Wallpaper changes, then a user who has enabled your Live Wallpaper will have their wallpaper revert to the system default when getting the new version of your app. The same is true for Input Methods, Accessibility Services, Honeycomb’s new advanced Widgets, and so on.
- If the name of a receiver implementing a Device Admin changes, then as with the live wallpaper example, the device admin will be disabled when the application is updated. This also applies to other kinds of receivers, such as App Widgets.
因此,如果可能,请不要更改清单中声明的??组件的名称,或使用下面的代码删除指向该组件的任何图标.
ComponentName componentToDisable = new ComponentName("application.package.name", "packagename.ActivityClassName");
getPackageManager().setComponentEnabledSetting(componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
还可以使用< intent-filter> …< / intent-filter>在清单中指定新的启动器活动.这样,当用户点击启动器图标时,您的新活动就会启动.
内容总结
以上是互联网集市为您收集整理的android – 在新的应用程序版本中更改启动器活动名称全部内容,希望文章能够帮你解决android – 在新的应用程序版本中更改启动器活动名称所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。