我正在开发一个在webview中使用Flash视频的项目.我解决了所有与代码有关的问题,但只在Honeycomb下工作.
阅读本文后,我发现了如何解决Android 3.0及更高版本(包括ICS)的问题,但现在这是一个大问题......如果我让我的项目与ICS兼容,我必须使用该指令,但后来我不知道跑在姜饼上.
为了提供更多信息......有问题的代码是这一个:
android:hardwareAccelerated="true"
Run Code Online (Sandbox Code Playgroud)
这是Android 3.0中包含的属性.
那么,有什么我可以做的,以避免建立两个不同的apks(somehitng像一个前HoneyComb apk和后HoneyComb apk)?
这是我的Android清单的一部分:
<application android:label="@string/app_name"
android:icon="@drawable/elabora"
android:theme="@android:style/Theme.NoTitleBar">
<activity android:name="es.fundacionvodafone.elabora.android.controlador.InicioElaboraTest"
android:label="@string/app_name"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="es.fundacionvodafone.elabora.android.controlador.InicioElabora"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:hardwareAccelerated="true">
<!--
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
-->
</activity>
Run Code Online (Sandbox Code Playgroud)
提前致谢.
更新:我已经在使用迈克解释的内容,也就是说,正确定义minSdk和targetSdk,但我对以下事实感到困惑.使用这样的项目配置,当您在eclipse中运行项目时,它会提示以下窗口:
红叉表示项目targetSdk级别高于设备API级别.所以我认为它只是不在这个设备上工作,但问题是你可以实际运行它,并按预期工作.
eclipse flash android webview android-4.0-ice-cream-sandwich
我有两部Galaxy Nexus手机.手机是相同的固件版本4.0.2,相同的内部版本号,相同的内核版本.当我使用Eclipse将相同的应用程序部署到两个手机时,我看到每个手机都有不同的行为.
在一部手机上,一切都按预期工作.在另一部手机上,当切换到另一个活动并返回到主活动时,主活动崩溃,通过后退按钮和其他活动完成并返回到创建它的活动.我遇到这个问题的唯一线索是这个错误:
04-18 17:43:30.811: I/ActivityManager(207): Displayed org.mitre.Mobile/.Activities.QueryActivity: +430ms
04-18 17:43:30.819: I/n*.w*.w*.ZoomButtonsCo*(4962): invoke: onVisibilityChanged listener: org.osmdroid.views.MapView$MapViewZoomListener@4181ecd8
04-18 17:43:30.843: E/InputQueue-JNI(4962): channel '41d66628 Panel:org.mitre.Mobile/org.mitre.Mobile.Activities.MobileActivity (client)' ~ Publisher closed input channel or an error occurred. events=0x8
04-18 17:43:30.843: W/WindowManager(207): Force-removing child win Window{41d66628 Panel:org.mitre.Mobile/org.mitre.Mobile.Activities.MobileActivity paused=false} from container Window{420815c8 org.mitre.Mobile/org.mitre.Mobile.Activities.MobileActivity paused=false}
04-18 17:43:30.850: W/WindowManager(207): Failed looking up window
04-18 17:43:30.850: W/WindowManager(207): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@41f9e658 does not exist
04-18 17:43:30.850: W/WindowManager(207): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7029)
04-18 17:43:30.850: W/WindowManager(207): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7020)
04-18 17:43:30.850: W/WindowManager(207): at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2180)
04-18 …Run Code Online (Sandbox Code Playgroud) 我正在尝试用两个标签在android中做一个简单的标签应用程序.我的问题是,当我把这个代码放在选项卡中时,只显示文本,但没有显示图标.如果我将文本放到"",则显示图标.
有人能帮助我吗?我的Android版本是4.0.3.
非常感谢.
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TabWidget android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs" />
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@android:id/tabcontent" >
<LinearLayout android:id="@+id/tab1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView android:id="@+id/textView1"
android:text="Contenido Tab 1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:id="@+id/tab2"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView android:id="@+id/textView2"
android:text="Contenido Tab 2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)
而活动代码是
public class TabTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle …Run Code Online (Sandbox Code Playgroud) 我正在遇到一个我正在处理的视频流应用程序的奇怪问题.实际的视频/音频流在我的所有测试设备上都能正常工作.然而,在看似任何设备4.0+时,当使用RTSP URL时,prepare()立即返回(这会导致在视频加载时向用户提供适当反馈的问题并干扰我现有的其他一些系统).
下面是我初始化和设置MediaPlayer的代码块,但请记住以下几点:
我一直试图解决这个荒谬的时间,并且无法找到遇到此问题的其他人.任何想法将不胜感激.
public void initPlayer() {
//We first need to make sure the MediaPlayer isn't null
if(mMediaPlayer==null){
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnPreparedListener(mediaPlayerPreparedListener);
mMediaPlayer.setOnCompletionListener(mediaPlayerCompletionListener);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
}
//If a video/stream has been chosen while another is already playing
else if(mMediaPlayer.isPlaying()){
mMediaPlayer.reset();
}
//Video is not in full screen mode
second = false;
try {
mMediaPlayer.setDataSource(videoString);
holder = mPreview.getHolder();
mMediaPlayer.setDisplay(holder);
mMediaPlayer.prepare();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalStateException …Run Code Online (Sandbox Code Playgroud) 冰淇淋三明治中的吐司通知是否有任何问题?在我的应用程序中,通知在所有其他版本上看起来很好.然而,在冰淇淋三明治中,它非常小巧.起初我认为它可能是我的自定义主题,但在禁用它后,我看到了相同的结果.我正像其他人一样展示Toast:
Toast.makeText(MyActivity.this, "Hello, World!", Toast.LENGTH_SHORT).show();
Run Code Online (Sandbox Code Playgroud)
我的主题:
<resources>
<style name="mytheme" parent="@android:style/Theme.Light.NoTitleBar" >
<item name="android:editTextStyle">@style/blue_edittext</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/White</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢!
我有一个NFC设备(SCL3711)和谷歌Nexus S手机.我写了一个应用程序,它将数据从手机发送到NFC设备,反之亦然.在Android 2.3.3上一切都运行良好.现在我将我的Nexus S操作系统更新为4.0.3冰淇淋三明治,一切都停止了.现在我无法将数据从手机发送到NFC设备,反之亦然.我可以理解的主要原因是我无法连接到设备,但为什么我无法理解.
请帮助我,提供一些链接或信息来考虑这个问题.一切都对我有所帮助.
01-25 13:12:42.629: DEBUG/NFC JNI(23320): Discovered P2P Initiator
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 46
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 66
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 6d
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 01
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 01
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 10
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 02
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 02
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 00
01-25 13:12:42.629: DEBUG/NFC JNI(23320): 00
01-25 13:12:42.633: DEBUG/NFC JNI(23320): 03
01-25 13:12:42.633: DEBUG/NFC JNI(23320): …Run Code Online (Sandbox Code Playgroud) 我有活动A呼叫活动B,活动B拨号,然后在IDLE-OFFHOOK-IDLE状态我调用ActivityB.this.finish(),以便活动A显示在前面.
从android 2.3.x到4.0版本,这一切都运行良好.
现在它不适用于android 4.0.3模拟器和4.0.2三星galaxy nexus 2.为什么?
有人可以帮忙吗?
logging android phone-call android-intent android-4.0-ice-cream-sandwich
我第一次注意到这是因为AlertDialogs将整个消息放在第一行,即使我指定了一个新行("\n").在ICS上它显示正确的方式,但对于我的生活,我无法让它在GB上工作.
最近我又碰到了它.我认为没有任何理由让它在ICS上工作正常但不在GB及以下.
示例项目
下面是一个带有textview,alertdialog和两个标准textview的示例项目.
https://github.com/T3hh4xx0r/Text-Example
编辑
这是我问的原始问题.似乎问题比我最初注意到的要多.
Android AlertDialog在某些设备上不显示整个setMessage
/编辑
这是我的意思的视觉例子.
即使专门为textView设置多行,文本仍然是一行,但下面有额外的空白行.
好的,所以我有下面的本机代码.我试图从它返回一个FilePermissionInfo数组,填充stat()返回的一些数据.问题是我第一次调用NewObject时出现以下错误:
06-15 20:25:17.621:W/dalvikvm(2287):decodeIndirectRef中的无效间接引用0x40005820 06-15 20:25:17.621:E/dalvikvm(2287):VM中止
这很奇怪,因为我唯一的参考对象是jclass(对于FilePermissionInfo),我把它变成了一个全局引用.
代码是:
JNIEXPORT jobjectArray JNICALL
Java_com_mn_rootscape_utils_NativeMethods_getFilesPermissions( JNIEnv* env, jobject thizz, jobjectArray filePathsArray )
{
jobjectArray result;
int size = (*env)->GetArrayLength(env, filePathsArray);
jboolean isCopy;
jclass filePermInfoCls = (*env)->FindClass(env, kFilePermissionInfoPath);
if(!filePermInfoCls)
{
LOGE("getFilesPermissions: failed to get class reference.");
return NULL;
}
gFilePermInfoClass = (jclass)(*env)->NewGlobalRef(env, filePermInfoCls);
LOGI("got gFilePermInfoClass");
jmethodID filePermInfoClsConstructor = (*env)->GetMethodID(env, gFilePermInfoClass, "<init>", kFilePermInfoConstructorSig);
if(!filePermInfoClsConstructor)
{
LOGE("getFilesPermissions: failed to get method reference.");
return NULL;
}
struct stat sb;
LOGI("starting...");
result = (jobjectArray)(*env)->NewObjectArray(env, size, gFilePermInfoClass, NULL);
for(int i …Run Code Online (Sandbox Code Playgroud) android native-code android-ndk android-4.0-ice-cream-sandwich
我们正在编写一个针对ICS +的应用程序,并认为GridLayout是最好的布局范例,但似乎很少有关于它的文章,我们遇到了一些对齐问题.
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row_background"
android:rowCount="1"
android:columnCount="3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:useDefaultMargins="true"
android:background="@drawable/list_item_bg">
<ImageView
android:id="@+id/visibilityIcon"
android:layout_row="0"
android:layout_column="0"
android:src="@drawable/visibility_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
<ImageView
android:id="@+id/windIcon"
android:layout_row="0"
android:layout_column="1"
android:src="@drawable/wind_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
<ImageView
android:id="@+id/crosswindIcon"
android:layout_row="0"
android:layout_column="2"
android:src="@drawable/cloud_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
</GridLayout>
Run Code Online (Sandbox Code Playgroud)
但是,左侧2图标保持左对齐,最右侧图标以剩余空间居中.
基本上我们需要做的是将每列的大小指定为总屏幕大小的1/3(自3列).我认为这就是GridLayout所做的,但看起来'wrap_content'会导致这种行为(有意义),但'match_parent'会导致第一列填满整个屏幕,而不是填充其单元格,这是我预期的行为.
我们似乎已经尝试过重力,layout_gravity等的所有组合,但要么我们从根本上做错了什么,要么发现了GridLayout的限制.
谢谢你的帮助!
android alignment grid-layout xml-layout android-4.0-ice-cream-sandwich
android ×10
android-4.0-ice-cream-sandwich ×10
java ×2
alignment ×1
android-ndk ×1
eclipse ×1
flash ×1
grid-layout ×1
logging ×1
media-player ×1
native-code ×1
nexus-s ×1
nfc ×1
phone-call ×1
rtsp ×1
tabs ×1
textview ×1
webview ×1
xml-layout ×1