我需要在Activity启动时为ListPreference设置defult值.我已尝试过,ListPreference.setDefaultvalue("value");
但它会将列表的第一个条目作为默认值.我需要它,因为我必须检查一个条件并设置为默认值满足该条件的值,所以我认为它不能从xml文件中完成(带android:defaultValue
)
例如,假设我在arrays.xml中有这个值数组:
<string-array name="opts">
<item>red</item>
<item>green</item>
<item>blue</item>
</string-array>
<string-array name="opts_values">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
Run Code Online (Sandbox Code Playgroud)
在PreferenceScreen xml中:
<ListPreference
android:title="Colour select"
android:summary="Select your favourite"
android:key="colour"
android:entries="@array/opts"
android:entryValues="@array/opts_values" />
Run Code Online (Sandbox Code Playgroud)
在活动中,我想做这样的事情:
String mycolour;
if (something) {
mycolour="1";
} else {
mycolour="2";
}
ListPreference colour = (ListPreference) findPreference ("colour");
colour.setDefaultValue(mycolour);
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为它使第一选择成为默认选择.你能解释一下如何制作另一个默认的吗?谢谢.
我不小心删除了我的一个项目模块.iml文件,我想知道它是否可以重新生成它.我已经google了一下,但我还没有看到解决方案.
我正在尝试使用带有默认设置的angular-seed模板.在controllers.js
我用
angular.module('myApp.controllers', []).
controller('MyCtrl1', [function($scope) {
$scope.test = 'scope found!';
}])
.controller('MyCtrl2', [function() {
}]);
Run Code Online (Sandbox Code Playgroud)
在那里,$scope
永远是不确定的.当我将控制器从模块中取出并在全局注册时,它可以正常工作.在这里:
function MyCtrl1($scope) {
$scope.test = "scope found!";
}
MyCtrl1.$inject = ['$scope'];
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释为什么会这样吗?
我是使用Linux的新手,我在篡改时打破了一些php设置.
如果我执行一个包含以下phpinfo();
内容的php脚本:它将php版本显示为5.6,但是通过命令行,如果我运行php -v
它,则返回7.0版本.
我希望两个版本都匹配.
我如何修复我的命令行PATH也使用PHP 5.6?
我正在寻找一种从Android设备检测iBeacon(iOS 7.0功能)的方法.我阅读了Android文档,其中似乎iBeacon是某种GATT服务器,它发送它的位置.虽然Android文档说我不应该轮询该数据,但是对于检测,这将是必要的.
我谷歌很多,但这个话题很新(我甚至创建了一个新标签ibeacon)所以如果我从iOS世界获得一些描述实现的资源链接,我会很高兴.此外,如果有一些Android库,我还没有找到它会很好.
升级后的消息说明:
Failed to refresh Gradle project 'XXX'
The project is using an unsupported version of the Android Gradle plug-in (0.8.3).
Version 0.9.0 introduced incompatible changes in the build language.
Please read the migration guide to learn how to update your project.
Run Code Online (Sandbox Code Playgroud)
升级到Android Studio到版本> = 0.8.0后出现同样的问题
android gradle android-studio build.gradle android-gradle-plugin
我正在使用IISExpress中内置的Visual Studio 2012在本地计算机上处理ASP.NET MVC应用程序.在取得重大进展后,我决定通过本地网络提供它,我从visual studio创建了一个虚拟目录.我可以登录,但是当我尝试注册新用户时.我收到以下错误.
防伪令牌无法解密.如果此应用程序由Web场或群集托管,请确保所有计算机都运行相同版本的ASP.NET网页,并且配置指定显式加密和验证密钥.AutoGenerate不能在群集中使用.
我从(ASPNET资源)生成了一个新的机器密钥并将其放在我的配置文件中,但仍然没有工作.有人建议解决方案吗?
我从Android Studio外部监控我的logcat(在我的模拟器旁边的另一个屏幕/工作区上打开了logcat-color),并希望在Android Studio中自动停止Android DDMS视图.它占用了屏幕空间,我宁愿为我的代码保留.
我知道我可以完全删除视图,但我希望保留对它的访问,因为我使用它来快速直接链接到有问题的代码行.
我可以过滤logcat输出只显示'错误'级别,但这不是一个很好的解决方案,因为我会不断更改过滤器以获取周围的日志条目,如果我想跟踪的问题.
运行控制台也是如此.我也想打开它.
有没有办法访问这两个视图,没有它们随时打开活动?我查看了设置,但找不到任何可能的候选人进行修改.
我是Web服务的新手,我一直试图在Internet上找到一个简单的Java SOAP客户端程序.
我想做的就是发送一条SOAP消息并收到一些响应.
有一个网站提供免费的网络服务.
http://www.webservicex.net/ws/WSDetails.aspx?WSID=17&CATID=7
您输入国家/地区名称,它会为您提供国家/地区的ISD代码.就这么简单.
我想将国家名称发送到Web服务,并仅使用Java而不使用任何外部jar来获取其ISD代码.
**从Windows 8中提取adt-bundle-windows-x86_64-20140702时发生此错误
(! D:\Bela\Work\adt-bundle-windows-x86_64-20140702.zip: Cannot create folder adt-bundle-windows-x86_64-20140702\sdk\tools\lib\monitor-x86\features\com.android.ide.eclipse.hierarchyviewer.feature_23.0.2.1259578\META-INF\maven\adt.group\com.android.ide.eclipse.hierarchyviewer.feature
The filename or extension is too long.
! D:\Bela\Work\adt-bundle-windows-x86_64-20140702.zip: Cannot create adt-bundle-windows-x86_64-20140702\sdk\tools\lib\monitor-x86\features\com.android.ide.eclipse.hierarchyviewer.feature_23.0.2.1259578\META-INF\maven\adt.group\com.android.ide.eclipse.hierarchyviewer.feature\pom.xml
Total path and file name length must not exceed 260 characters
The system cannot find the path specified.
! D:\Bela\Work\adt-bundle-windows-x86_64-20140702.zip: Cannot create adt-bundle-windows-x86_64-20140702\sdk\tools\lib\monitor-x86\features\com.android.ide.eclipse.hierarchyviewer.feature_23.0.2.1259578\META-INF\maven\adt.group\com.android.ide.eclipse.hierarchyviewer.feature\pom.properties
Total path and file name length must not exceed 260 characters
The system cannot find the path specified.)
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
android ×6
java ×3
adt ×1
angularjs ×1
asp.net-mvc ×1
build.gradle ×1
ddms ×1
eclipse ×1
eclipse-adt ×1
gradle ×1
ibeacon ×1
ios7 ×1
linux ×1
logcat ×1
php ×1
preference ×1
soap ×1
soap-client ×1
ubuntu ×1
web-config ×1