在Android模拟器中,据我了解你可以模拟常规手机的大部分功能,后面是由ESC模拟,什么是在Android模拟器中按下主页按钮的快捷方式.
我正在使用Eclipse在Android中开发应用程序.我编写了以下代码,在测试中第一个和第三个" if "块无法访问.为什么?
当我向数字添加前导零时,等于运算符返回false.
int var = 123;
if (var == 0123) {
//not reachable
}
if (var == 123) {
//reachable
}
if (var == (int)0123) {
//not reachable
}
if (var == (int)123) {
//reachable
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试,为了实施新的GCM,我正在关注Google的说法:http: //developer.android.com/guide/google/gcm/gs.html
我在获取设备注册ID时遇到困难!
我的应用不断尝试与Google服务器连接,这里我的错误日志:
onReceive: com.google.android.gcm.intent.RETRY
GCM IntentService class: com.dombox.app.GCMIntentService
Acquiring wakelock
[GCMIntentService] start
Registering app com.dombox.app of senders _my_sender_id_
Releasing wakelock
onReceive: com.google.android.c2dm.intent.REGISTRATION
GCM IntentService class: com.dombox.app.GCMIntentService
Acquiring wakelock
[GCMIntentService] start
handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
Registration error: SERVICE_NOT_AVAILABLE
Scheduling registration retry, backoff = 912617 (768000)
Releasing wakelock
Run Code Online (Sandbox Code Playgroud)
这是我的活动代码,要求提供ID:
try{
Log.i(TAG, "[checkNotifRegistration] checkDevice");
GCMRegistrar.checkDevice(this);
Log.i(TAG, "[checkNotifRegistration] checkManifest");
GCMRegistrar.checkManifest(this);
if (GCMRegistrar.isRegistered(this)) {
Log.i(TAG, "[checkNotifRegistration] reg id : "+GCMRegistrar.getRegistrationId(this));
}
final String …Run Code Online (Sandbox Code Playgroud) 我只是按照一个简单的地图教程http://developer.android.com/resources/tutorials/views/hello-mapview.html但收到此错误.我是android的新手我试图遵循通过互联网提供的所有解决方案,但还没有成功.请帮我.我的主要.xml在下面
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="***"
/>
Run Code Online (Sandbox Code Playgroud)
和manifestfile就是这个
我的用户使用触摸事件在我的应用程序中绘制他们的签名,然后将其转换为位图.我想提取每个签名的唯一规范,并根据存储在主服务器中的规范进行比较.
我怎样才能做到这一点?
提取签名的唯一功能的主要和企业算法是什么?
提前致谢,
在Eclipse中添加多行注释并对其进行格式化(Ctrl + Shift + F)时,它会自动在注释块内的每个新行的开头放置一个星号(*).
/*
* this is my comment
*/
Run Code Online (Sandbox Code Playgroud)
这种行为的原因是什么?
我该如何禁用它?
我知道您可以使用分割字符串myString.split("something").但我不知道如何用两个分隔符分割字符串.
例:
mySring = "abc==abc++abc==bc++abc";
Run Code Online (Sandbox Code Playgroud)
我需要这样的东西:
myString.split("==|++")
Run Code Online (Sandbox Code Playgroud)
它的常规表达是什么?
我开发了一个Android应用程序,用于存储用户的GPS位置.
我的一位客户给了我他的设备,我注意到有时设备的准确性非常糟糕且令人难以置信.有时,设备返回距实际位置约200公里的点.
您可以在该设备的以下GPS位置示例中看到此信息.你看到两点距离真实位置约200公里.
该设备是三星SM-T111与Android 4.2.2,我只使用GPS提供商获取位置(LocationManager.GPS_PROVIDER).
我想知道导致问题的原因是什么,这种不准确?
我直接存储从提供商处收到的积分.这是我的代码onLocationChanged:
UPDATE
@Override
public void onLocationChanged(Location location) {
try {
if (location.getAccuracy() <= MAX_DISTANCE_TOLERANCE) {
gotLocation(new GPSLocation(location.getLatitude(),
location.getLongitude(), location.getTime(),
location.getAccuracy(),
location.getProvider(), location.getSpeed()));
}
} catch (Exception e) {
MessageBox.showExceptionToast(_context, e);
}
}
Run Code Online (Sandbox Code Playgroud)
我有两种不同的布局,用于两种不同的活动.每个布局中都有一个具有相同ID的按钮:"@ + id/btnOK".当我以编程方式为其中一个按钮设置属性时,我得到一个NullPointerException.但是当我更改其中一个ID时,一切都还可以.
我们不能在android中的不同布局中拥有重复的ID吗?
我已经创建了一个双语(有两种语言)的android应用程序.我已将资源字符串插入两个文件中:
For Persian language (default)
values/strings_locale.xml?
For English language
values-en/strings_locale.xml?
Run Code Online (Sandbox Code Playgroud)
我第一次启动Activity我插入了以下代码:
Configuration c = new Configuration(this.getResources().getConfiguration());
c.locale = new Locale("fa_IR");
this.getResources().updateConfiguration(c, this.getResources().getDisplayMetrics());
Run Code Online (Sandbox Code Playgroud)
因此,在此代码之后,我的默认语言将是波斯语,并且所有活动中的所有字符串都以波斯语正确显示.
但问题是当设备的屏幕旋转时,所有字符串都以英语显示,并且所有其他活动也会出现!我必须关闭并重新打开我的申请.
为什么会发生这种情况以及如何解决这个问题?