我刚刚将我的系统升级到Ice Cream Sandwich(Android 4.0),现在每当我尝试在调试器中运行我的应用程序时,我都会遇到崩溃aapt.exe.
如果我只是构建,它构建正常,但是当我在调试器中运行它时,aapt.exe崩溃(弹出一个对话框并询问我是否要向Microsoft发送数据)和我的项目图标Project_Explorer显示它有错误( S).
我用自定义动画(向上和向下滑动)制作了一个主题。动画在较旧的 android 版本上运行良好。但是,当我在 Android 4.0 (ICS) 上尝试时,关闭动画不起作用。只有上滑动画在 ICS 上运行良好。
这是我用于动画的主题:
<style name="myTheme" parent="android:Theme.Black">
<item name="android:windowTitleSize">45dip</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
<item name="android:windowAnimationStyle">@style/myTheme.Window</item>
</style>
<style name="myTheme.Window" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/push_up_in_no_alpha</item>
<item name="android:activityOpenExitAnimation">@anim/no_anim</item>
<item name="android:activityCloseEnterAnimation">@anim/no_anim</item>
<item name="android:activityCloseExitAnimation">@anim/push_down_out_no_alpha</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这是push_down_out_no_alpha.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0" android:toYDelta="100%p"
android:duration="@android:integer/config_longAnimTime"/>
</set>
Run Code Online (Sandbox Code Playgroud)
当我在代码中设置动画时,它在 ICS 上也能正常工作,但为什么不作为主题呢?
this.overridePendingTransition(R.anim.no_anim,R.anim.push_down_out_no_alpha);
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么它不能在 Android 4.0 (ICS) 上运行?
我有一个带有操作栏的应用程序,如下所示:

我希望菜单操作按钮"Home"和"Logout"的文本也是白色的.如何更改文字颜色?
如果您想查看任何代码,请告诉我们.
谢谢!
android android-theme android-4.0-ice-cream-sandwich actionbarsherlock android-actionbar
我尝试连接Xmpp服务器,但我得到了异常
使用DIGEST-MD5机制登录异常SASL身份验证失败
我使用这个代码,任何人都可以帮助我,或代码
try {
if (xmppConnection == null) {
ConnectionConfiguration config = new ConnectionConfiguration(
SERVER_HOST, SERVER_PORT, SERVICE_NAME);
xmppConnection = new XMPPConnection(config);
System.out.println("xmppConnection"+xmppConnection);
}
if (!xmppConnection.isConnected()) {
xmppConnection.connect();
System.out.println("Connecting");
}
System.out.println("facebook id get xmpp "+username);
if (!xmppConnection.isAuthenticated()) {
xmppConnection.login(username, "123");
System.out.println("User is authenticated ");
}
Presence presence = new Presence(Presence.Type.available);
xmppConnection.sendPacket(presence);
} catch (Exception e) {
System.out.println("Login exception "+e);
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud) android xmpp xmppframework asmack android-4.0-ice-cream-sandwich
是否可以在ICS中嵌套片段?我的意思是我们可以膨胀一个包含一个或多个片段的布局xml文件,并使用Fragment.onCreateView将其提供给父片段视图吗?
我需要你的帮助.我的应用程序在GingerBread上工作正常,但在ICS和HC崩溃.这是logcat
01-14 20:26:51.831: E/AndroidRuntime(698): FATAL EXCEPTION: main
01-14 20:26:51.831: E/AndroidRuntime(698): android.os.NetworkOnMainThreadException
01-14 20:26:51.831: E/AndroidRuntime(698): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
01-14 20:26:51.831: E/AndroidRuntime(698): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
01-14 20:26:51.831: E/AndroidRuntime(698): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
01-14 20:26:51.831: E/AndroidRuntime(698): at java.net.InetAddress.getAllByName(InetAddress.java:220)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
01-14 20:26:51.831: E/AndroidRuntime(698): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
01-14 20:26:51.831: E/AndroidRuntime(698): at …Run Code Online (Sandbox Code Playgroud) java crash android android-layout android-4.0-ice-cream-sandwich
我有一个应用程序来处理从库中选择的图片.但ICS上有这样的堆栈跟踪崩溃:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, Intent { dat=content://com.google.android.gallery3d.provider/picasa/item/5629933319233370946 }} to activity {com.myexample/com.myexample.activities.UserProfileActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3023)
at android.app.ActivityThread.access$1100(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1177)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException
at java.io.File.fixSlashes(File.java:185)
at java.io.File.(File.java:134)
at com.jettaxi.activities.UserProfileActivity.onActivityResult(SourceFile:316)
at android.app.Activity.dispatchActivityResult(Activity.java:4649)
at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
... 11 more
Run Code Online (Sandbox Code Playgroud)
我发现了一些关于这种bug的信息,但是我可以避免这种情况吗?
编辑:我的代码:
private void getImageFromGallery() {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, GALLERY_PIC_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int …Run Code Online (Sandbox Code Playgroud) 有一些代码在Android 2.2上完美运行,但在Android 4中只生成黑色视图.这是onDraw方法:
//Object initialization
Paint paint=new Paint();
PorterDuffXfermode exclude=new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT);
paint.setAntiAlias(true);
paint.setDither(true);
//The dimensions are OK and they are at the center of the screen
canvas.drawBitmap(mask, screenWidth / 2 - pixelsToSp(100), screenHeight / 2 - pixelsToSp(100), paint);
paint.setXfermode(exclude);
//PS:targetRect is a portion of screen
canvas.drawBitmap(source, null, targetRect, p);
paint.setXfermode(null);
Run Code Online (Sandbox Code Playgroud)
PS:掩码和聚光灯是两个位图.
在没有设置Xfermode绘制的情况下,绘制了两个位图(对于我的范围不正确,但是在正确的位置绘制并且具有正确的大小)
我的问题:我可以支持更老的api并使用更新api的功能吗?
我的情况:我正在构建一个简单的应用程序,我希望通过UI支持一些高级功能(如果可用).但我支持的API级别是13,所以我可以支持Android 3.2.具体来说,我想使用View.SYSTEM_UI_FLAG_*变量,但这些变量在api 13级中不可用.
android android-3.0-honeycomb android-4.0-ice-cream-sandwich
我使用的android:autoLink设置为web一个TextView在我的Android应用程序,以使可点击的链接.但如果我在我的HTC Desire S升级到ICS上运行此操作,当我点击其中一个链接时,我得到以下异常
android.content.ActivityNotFoundException: Unable to find explicit activity class
{com.htc.HtcLinkifyDispatcher/
com.htc.HtcLinkifyDispatcher.HtcLinkifyDispatcherActivity};
have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1634)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1510)
at android.app.Activity.startActivityFromChild(Activity.java:3519)
at android.app.Activity.startActivityForResult(Activity.java:3271)
at android.app.Activity.startActivity(Activity.java:3358)
at woodsie.avalanche.info.InfoActivity.startActivity(InfoActivity.java:61)
at android.text.style.LinkifyURLSpan.onClick(LinkifyURLSpan.java:73)
Run Code Online (Sandbox Code Playgroud)
尝试注册HtcLinkifyDispatcherActivity让我无处可去,因为课程不在我的构建路径上.