android-4.0-ice-cream-sandwich

use holo theme on Android < 4.0

那年仲夏 提交于 2019-11-28 17:08:25
问题 I'm developing an app for Android 2.2 and higher. I use the great ActionBarSherlock (thank you, Jake Wharton !!) to use the action bar on pre-ICS devices. While the actionbar looks great, all other gui elements have the look of the default theme of the device (in my case HTC Sense 3). Is there a possibility to style my (>= Android 2.2) app on all android devices with the Holo.Dark.Theme? I compile my app with Android 4.0.3, the minSDK version is 8. 回答1: Enjoy HoloEverywhere, that's the whole

Appwidget size calculation

ⅰ亾dé卋堺 提交于 2019-11-28 16:07:28
It might be me, but when I calculate minimum app widget sizes according to the formula given on the android page I don't get the right widget widths; The formula is as follows : width(n) = (70 x n) - 30 When I want to have a 5x1 widget, the correct width would be (5 * 70) - 30 = 320dp. However when testing this on a motorola Xoom it resolves to being a 4x1 widget. I've tested different values and 400dp seems good for 5x1 on the motorola xoom with Honeycomb, but then I'd test it on a regular Galaxy Tab with Gingerbread and then it resolves to a 6x1 (like one would expect). So two questions here

networkOnMainThread Exception Android

蹲街弑〆低调 提交于 2019-11-28 14:25:19
I'm trying to access a server so I can receive a JSON String. But apparently in Ice Cream Sandwich you can't do network operations in the main thread, but the AsyncTask class is confusing me and not working. Here's what I have so far: //up in main code Void blah = null; URI uri = "kubie.dyndns-home.com/R2Bar2/ingredients.php"; new DownloadFilesTask().execute(uri , blah, blah); private class DownloadFilesTask extends AsyncTask<URI, Void, Void> { protected Void doInBackground(URI... uri) { HttpClient client = new DefaultHttpClient(); String json = ""; int duration = Toast.LENGTH_SHORT; try {

Scrollable App widgets

﹥>﹥吖頭↗ 提交于 2019-11-28 13:32:28
问题 Scrollable App widgets are included in ICS and honeycomb ...for example the mail widget and bookmark widget I want to code a custom scrollable widget for me for ICS ... But I am unable to find any source and references..please suggest 回答1: App Widgets can be used with collections: http://developer.android.com/guide/topics/appwidgets/index.html#collections For example android.widget.ListView and android.widget.GridView 来源: https://stackoverflow.com/questions/8815572/scrollable-app-widgets

Launch “launcher app drawer” from an application?

北城以北 提交于 2019-11-28 13:03:02
I would like to launch (or go back) from an application to the launcher app drawer with the tiled app icons, not to the desktop. Intent intent = new Intent("android.intent.action.MAIN"); intent.setComponent(new ComponentName("com.android.launcher","com.android.launcher2.Launcher")); intent.addCategory("android.intent.category.LAUNCHER"); startActivity(intent); This code "launches" the desktop. I would like to reach the app icons . How can I achieve that? The Manifest of Launcher doesn't seem to give any activity for this? Gregoire As pointed out by aneal, you can't call this view as it's not

Android app doesn't work on Android 4

寵の児 提交于 2019-11-28 12:26:25
问题 I created an Android project on 2.3.3 and tried it on mobile 2.3.3, everything works OK. It didn't work on mobile 4, so I re-built for Android 4, but I have the same problem. This is the code: public void FTP_Download(){ String server = "192.168.1.135"; int port = 21; String user = "pc1"; String pass = "1551"; FTPClient ftpClient = new FTPClient(); try { ftpClient.connect(server, port); ftpClient.login(user, pass); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE)

Bitmaps on ICS are loaded with wrong pixel format

安稳与你 提交于 2019-11-28 10:58:52
I encountered the following problem. When any bitmap is loaded from resources by an application running on Ice Cream Sandwich, it will likely be rendered incorrectly as if it has been decoded to the format, which differs from the current window format, with no dither applied. However, both, the decoding format and window format have been explicitly set: BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inPreferredConfig = Bitmap.Config.RGBA_8888; and getWindow().setFormat(PixelFormat.RGBA_8888); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER); Here are screenshots of

flash player crashes when trying to enter fullscreen mode android 4.0

我的梦境 提交于 2019-11-28 10:14:05
问题 So I've created an android app that plays video from blip.tv and various other flash-enabled websites. I use a Webview to display the video. Here is my code: try{ requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); view = new WebView(this); view.getSettings().setPluginsEnabled(true); view.getSettings().setPluginState(WebSettings

Cannot convert from android.support.v4.app.Fragment to android.app.Fragment

烈酒焚心 提交于 2019-11-28 09:35:14
I'm doing my first Android app, and wanted to get straight into the ICS API. I have so far created an app using an ActionBar, with swipeable tabs using Viewpager and Fragments. I do however experience some errors that I keep returning to. Depending on how I implement it, it always keep going back to an "Type mismatch" error: "cannot convert from android.support.v4.app.Fragment to android.app.Fragment". I have tried removing all import references to either, and this error appears when I only use android.support.v4.app.Fragment in TabListener, FragmentActivity and my two Fragments. The error

Android AVD not recognizing device but ADB does

江枫思渺然 提交于 2019-11-28 08:52:16
问题 I'm trying to get my device to debug my software but it won't show up in the AVD list. The ADB can see it and so does the Eclipse device manager. I can get an interactive shell using adb etc. C:\Program Files (x86)\Android\android-sdk\platform-tools>adb devices List of devices attached BX9038ZRUV device Does anyone understand what's going on and how I should fix it? I'm running Windows 7 and my phone is a Sony Ericson Xperia S running Android 4.0.4. 回答1: avd is only for virtual Device. What