昨天API 19问世,所以我现在升级了SDK和其他(包括Google Play Services)这个方法:
private boolean isGooglePlayInstalled(){
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if(status == ConnectionResult.SUCCESS){
return true;
}else{
((Dialog)GooglePlayServicesUtil.getErrorDialog(status, this,10)).show();
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
投掷线
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value. Expected 4030500 but found 0.
You must have the following declaration within the <application> element:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Run Code Online (Sandbox Code Playgroud)
如何解决?我没有元素
"com.google.android.gms.version"在清单之前和它的工作.
这是我的表现:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sabatsoft.driveit"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" /> …Run Code Online (Sandbox Code Playgroud) 我需要创建一个脚本,将多个文本文件连接成一个.我知道它简单易用
type *.txt > merged.txt
Run Code Online (Sandbox Code Playgroud)
但要求是"将文件从同一天连接到文件day_YYYY-DD-MM.txt"我是linux用户,windows批处理对我来说很难.
编辑:它的Windows XP
如果设备在运动,重力传感器是否返回正确的值?我认为重力传感器使用加速度计来识别重力方向。这两个传感器是不同的硬件吗?
我通过netbeans insercode生成方法hashCode()和equals(Object obj).在netbeans我可以编译没有错误,但当我在我的服务器上用javac编译它:
bangserver/Login.java:3: cannot find symbol
symbol : class Objects
location: package java.util
import java.util.Objects;
^
Run Code Online (Sandbox Code Playgroud)
和对象的其他错误......
public int hashCode() {
int hash = 5;
hash = 47 * hash + Objects.hashCode(this.password);
return hash;
}
Run Code Online (Sandbox Code Playgroud)
你们认为应该是什么问题他找不到java.util.Objects?
我需要将字符串转换为变量值.我找到了仅针对C#的解决方案.我需要用Java.
public class Property<T> {
T value;
public void setValue(String input){
if(value instanceof String){
value= input; // value is type of T not type of string (compilation error)
// incompatible types: String cannot be converted to T
}
if(value instanceof int){
//parse string
}
if(value instanceof boolean){
//parse string
}
...
}
}
Run Code Online (Sandbox Code Playgroud) 我知道如何从鼠标左键单击所选项目中获取项目.我可以用TreeSelectionListener.
tree.addTreeSelectionListener(new TreeSelectionListener(){
@Override
public void valueChanged(TreeSelectionEvent tse) {
DefaultMutableTreeNode node =
(DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
}
});
Run Code Online (Sandbox Code Playgroud)
但我需要用鼠标右键单击项目.显示与单击的项目相关的弹出菜单.我试过这个:
private void treeClicked(java.awt.event.MouseEvent evt) {
if(SwingUtilities.isRightMouseButton(evt)){
this.listRightClickMenu.show(this,evt.getX(),evt.getY());
DefaultMutableTreeNode node =
(DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
}
}
Run Code Online (Sandbox Code Playgroud)
但是如果用户用右键单击项目就会出现问题.右键单击不选择项目.如何按事件坐标选择项目或如何解决这个问题?主要我需要获取被点击的对象,如果可能的话,没有选择项目.
我需要每秒更新我的TextView.我用Timer和TimeTask写了它,但是每个人都说它被弃用的方法.有人可以告诉我如何制作简单的计时器,每1秒更新一次TextView,可能会从UI停止吗?
我需要创建我现有的新项目.我复制了src,res和manifest但是当我导入外部库(BugSense,AChartEngine)时它不会启动而我得到
[2014-01-26 14:58:01 - Dex Loader] Unable to execute dex: GC overhead limit exceeded
[2014-01-26 14:58:01 - MyApp] Conversion to Dalvik format failed: Unable to execute dex: GC overhead limit exceeded
Run Code Online (Sandbox Code Playgroud)
当我取消 Android private libraries在Java Build Path / Order and Export它运行在移动设备,但它崩溃上:
java.lang.NoClassDefFoundError: com.bugsense.trace.BugSenseHandler
Run Code Online (Sandbox Code Playgroud)
之前运作良好.