我一直试图找出原因,但我不能.有谁能够帮我?
请看下面的例子.
float f = 125.32f;
System.out.println("value of f = " + f);
double d = (double) 125.32f;
System.out.println("value of d = " + d);
Run Code Online (Sandbox Code Playgroud)
这是输出:
值f = 125.32
值d = 125.31999969482422
我正在尝试根据以下链接创建Android PhoneGap项目:http://docs.phonegap.com/en/edge/guide_platforms_android_index.md.html
但是,当我运行命令时:
cordova platform add android
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
Checking Android requirements...
Creating android project...
[Error: An error occured during creation of android sub-project. Looks like your environment fully supports cordova-android development!
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.example.hello
Name: HelloWorld
Android target: android-17
Building cordova-3.2.0-rc1.jar
{ [Error: Command failed:
BUILD FAILED
/path/to/adt/sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/path/to/adt/sdk/tools/ant/build.xml:698: null returned: 127
Total time: 1 second
] killed: false, code: 1, …Run Code Online (Sandbox Code Playgroud) 我正在尝试让我的应用通过https与我的服务器通信.由于我不想付费以获得由受信任的CA签署的服务器证书,因此解决方案是使用自签名证书.
所以,我创建了我的caconfig.cnf如下:
[ ca ]
default_ca = CA_default # The default ca section
[ CA_default ]
dir = ./demoCA # top dir
database = $dir/index.txt # index file.
new_certs_dir = $dir/newcerts # new certs dir
certificate = $dir/cacert.pem # The CA cert
serial = $dir/serial # serial no file
private_key = $dir/private/cakey.pem # CA private key
RANDFILE = $dir/private/.rand # random number file
default_days = 365 # how long to certify for
default_crl_days = 30 # how long before next …Run Code Online (Sandbox Code Playgroud) 当我打开我的应用程序时,会启动一个Activity,并且在其onCreate方法中我正在检查某些条件.如果条件为真,我完成当前活动并打开另一个活动.问题是:第一个活动在屏幕上闪烁,然后第二个活动打开.代码如下:
public class FirstActivity extends Activity {
@Override
protected final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//some code here...
checkSomeStuff();
setContentView(R.layout.my_layout);
//some code here...
}
private void checkSomeStuff() {
if (/*some condition*/) {
final Intent intent = new Intent(this, SecondActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
finish();
startActivity(intent);
}
}
}
Run Code Online (Sandbox Code Playgroud)
请注意,setContentView()在检查之后,但在第二个活动开始之前,第一个活动仍然在屏幕上闪烁.有谁知道怎么让它不眨眼?
提前致谢.