我从CyanogenMod 9编译了Trebuchet启动器,并试图用adb安装它:
$ adb install out/target/product/generic/system/app/Trebuchet.apk
3986 KB/s (7870141 bytes in 1.928s)
pkg: /data/local/tmp/Trebuchet.apk
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
Run Code Online (Sandbox Code Playgroud)
我试用了带有CM9的Nexus S和带有JB的Galaxy Nexus.为什么我收到此错误?
编辑:在我的情况下,我试图用包管理器重新安装系统包.那是不支持的,所以我有这个错误.在您的情况下,错误的来源可能会有所不同.
android cyanogenmod android-4.0-ice-cream-sandwich android-4.2-jelly-bean
我想知道android-support-v4.jar 和android-support-v7-appcompat.jar之间的区别.如果我想在我的应用程序中添加appcompat Action Bar,我需要添加android-support-v7-appcompat.jar和android-support-v4.jar,或者只添加android-support-v7-appcompat.jar.
另外,android-support-v13.jar有appcompat吗?
android android-compatibility android-4.0-ice-cream-sandwich android-support-library android-actionbar-compat
是否可以更改操作栏中的溢出图标?我有所有ActionBar项目的蓝色图标,我还想在出现时更改溢出图标.
android android-3.0-honeycomb android-4.0-ice-cream-sandwich android-actionbar
我正在尝试添加SearchView对Android 3.0+ ActionBar的支持,但我无法让它OnCloseListener工作.
这是我的代码:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
searchView = (SearchView) menu.findItem(R.id.search_textbox).getActionView();
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String newText) {
searchLibrary(newText);
return false;
}
@Override
public boolean onQueryTextSubmit(String query) { return false; }
});
searchView.setOnCloseListener(new OnCloseListener() {
@Override
public boolean onClose() {
System.out.println("Testing. 1, 2, 3...");
return false;
}
});
return true;
}
Run Code Online (Sandbox Code Playgroud)
搜索效果很好,每个人都在工作,除了OnCloseListener.没有任何东西被打印到Logcat.这是我按下"关闭"按钮时的Logcat:
02-17 13:01:52.914: I/TextType(446): TextType = 0x0
02-17 13:01:57.344: I/TextType(446): TextType = 0x0
02-17 13:02:02.944: I/TextType(446): …Run Code Online (Sandbox Code Playgroud) android android-3.0-honeycomb android-4.0-ice-cream-sandwich android-actionbar
我正在使用Android 4.0 ICS和片段开发应用程序.
考虑ICS 4.0.3(API级别15)API的演示示例应用程序中的此修改示例:
public class FragmentTabs extends Activity {
private static final String TAG = FragmentTabs.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
bar.addTab(bar.newTab()
.setText("Simple")
.setTabListener(new TabListener<SimpleFragment>(
this, "mysimple", SimpleFragment.class)));
if (savedInstanceState != null) {
bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
Log.d(TAG, "FragmentTabs.onCreate tab: " + savedInstanceState.getInt("tab"));
Log.d(TAG, "FragmentTabs.onCreate number: " + savedInstanceState.getInt("number"));
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt("tab", getActionBar().getSelectedNavigationIndex());
}
public static class TabListener<T extends Fragment> implements ActionBar.TabListener { …Run Code Online (Sandbox Code Playgroud) 我想Holo.Light在支持它的设备上使用主题,然后回到Light其他设备上的常规主题.
目前,引用Holo.Light在3.0+上工作正常,但较旧的API只是恢复到默认的"黑暗"主题.我可以通过样式继承来实现我想要的吗?
android android-theme android-3.0-honeycomb android-4.0-ice-cream-sandwich
我正在做一个计算器.所以我Buttons用数字和函数做了我自己的.必须计算的表达式是在一个EditText,因为我希望用户也可以在表达式的中间添加数字或函数,所以EditText我有cursor.但我想Keyboard在用户点击时禁用EditText.我发现这个例子可以Android 2.3,但是ICS禁用Keyboard了光标和光标.
public class NoImeEditText extends EditText {
public NoImeEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onCheckIsTextEditor() {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
然后我NoImeEditText在我的XML文件中使用它
<com.my.package.NoImeEditText
android:id="@+id/etMy"
....
/>
Run Code Online (Sandbox Code Playgroud)
如何使这个EditText与ICS兼容??? 谢谢.
keyboard android android-edittext android-4.0-ice-cream-sandwich
我正在尝试使用新的通知界面.我已经为通知添加了3个按钮,并且我想在点击每个按钮后将其保存到我的数据库中.
通知本身运行良好,并在调用时显示,我只是不知道如何捕获三个不同的按钮单击中的每一个.
我用a BroadcastReceiver来捕捉点击,但我不知道如何判断点击了哪个按钮.
这是代码AddAction(我已经排除了通知的其余部分,因为它运作良好) -
//Yes intent
Intent yesReceive = new Intent();
yesReceive.setAction(CUSTOM_INTENT);
Bundle yesBundle = new Bundle();
yesBundle.putInt("userAnswer", 1);//This is the value I want to pass
yesReceive.putExtras(yesBundle);
PendingIntent pendingIntentYes = PendingIntent.getBroadcast(this, 12345, yesReceive, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.addAction(R.drawable.calendar_v, "Yes", pendingIntentYes);
//Maybe intent
Intent maybeReceive = new Intent();
maybeReceive.setAction(CUSTOM_INTENT);
Bundle maybeBundle = new Bundle();
maybeBundle.putInt("userAnswer", 3);//This is the value I want to pass
maybeReceive.putExtras(maybeBundle);
PendingIntent pendingIntentMaybe = PendingIntent.getBroadcast(this, 12345, maybeReceive, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.addAction(R.drawable.calendar_question, "Partly", pendingIntentMaybe);
//No intent
Intent noReceive = …Run Code Online (Sandbox Code Playgroud) notifications android broadcastreceiver android-intent android-4.0-ice-cream-sandwich
我正在尝试使用谷歌的新api,特别是动作栏.
当构建设置为api 10时,如果我按下菜单按钮,我会看到漂亮的菜单选项,每个选项都带有图片和图标.当使用api 14时,无论我尝试什么,它总是将图标放在操作栏中,没有文字.我已经尝试了我能想到的一切.我给了它"with text"属性,将文本更改为单个字符(如果是房间问题),但没有.
我之前已经看过这个,甚至在android.developer的开发者指南中,但我似乎无法找到答案如何让它出现.