android-3.0-honeycomb

How to invoke the ActionBar's ContextMenu-like behavior?

我是研究僧i 提交于 2019-11-27 20:38:39
In Android 3.0, when you select some text for example, the ActionBar switches to a ContextMenu-like mode, which enables you to do actions with the selected text: copy/share/etc, and a "Done" button appears on the left side to enable the user to leave this mode. How can I switch the ActionBar into this mode in my app (with my menu items of course)? I just couldn't find this in the docs. CommonsWare Yeah, I couldn't find it either -- I had to ask at Google I|O. Use startActionMode() . Here is one of their samples that demonstrates it. I need to do more work in this area myself. Jeff Axelrod To

How to dismiss keyboard in Android SearchView?

夙愿已清 提交于 2019-11-27 19:57:50
I have a searchView in the ActionBar. I want to dismiss the keyboard when the user is done with input. I have the following queryTextListener on the searchView final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { // Do something return true; } @Override public boolean onQueryTextSubmit(String query) { showProgress(); // Do stuff, make async call getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); return true; } }; Based on similar questions, the following

Converting input stream into bitmap

放肆的年华 提交于 2019-11-27 19:16:46
I have problems converting a input stream from web into bitmap. Problem occurs only when input image type is .BMP (bitmap). In that case: bitmapFactory.decodeStream returns null . Any hints how to fix this problem or where should I continue my debugging? Platform: Android (Honeycomb) URLConnection conn = url.openConnection(); conn.connect(); inputStream = conn.getInputStream(); bufferedInputStream = new BufferedInputStream(inputStream); bmp = BitmapFactory.decodeStream(bufferedInputStream); Thank you @Amir for point out the log. Discovered a line: decoder->decode returned false This seems to

Android Create custom SearchView Search action

六月ゝ 毕业季﹏ 提交于 2019-11-27 18:52:01
In my application I am using the Action Bar with a custom SearchView in it. I want to use some custom code when the user hits the enter button in the search field. But I cant find a way to catch the moment the user hits the enter button in the SearchView. Now I tried several ways to capture the search action but I cant seem to find it. My button is defined like this: <item android:id="@+id/action_bar_search" android:title="Search" android:icon="@drawable/ic_menu_search" android:showAsAction="always" android:actionViewClass="-package-.CustomSearchView" /> With this belongs the CustomSearchView

Honeycomb notifications - How to set largeIcon to the right size?

╄→гoц情女王★ 提交于 2019-11-27 18:19:25
I find myself curious why the setLargeIcon method on Notification.Builder only accepts a Bitmap, with no overload to provide a resource id. Perhaps it was done for performance reasons, but it seems odd as setSmallIcon does accept a res drawable id. Notification.Builder builder = new Notification.Builder(application); // .... builder.setLargeIcon(iconBitmap); // Requires a Bitmap builder.setSmallIcon(iconResId); // Requires a drawable resource ID Notification notification = builder.getNotification(); Sadly the bitmap provided is not scaled in the notification, so the Bitmap needs to be provided

What are the benefits of CursorLoaders?

北战南征 提交于 2019-11-27 18:01:36
I use Cursors extensively in my app, to load and occasionally write information from and to a database. I have seen that Honeycomb and the Compatibility Package have new Loader classes designed to help with loading data in a "good" way. Essentially, are these new classes (in particular CursorLoader ) considerably better than previous methods of managing data? What is the benefit of a CursorLoader over managed Cursors for example? And I use a ContentProvider to deal with data, which obviously takes Uris but how does this mesh with the initLoader() method? Must I set up each of my Fragments to

Updating an ongoing notification quietly

ⅰ亾dé卋堺 提交于 2019-11-27 17:59:16
I have a service which connects to other devices wirelessly. When the service is enabled, I have an ongoing notification which states it is enabled. After the service is enabled, the user then connects to another device. At this point, I would like to update my ongoing notification to state the name of the device which has been connected to. This is easy enough to do by calling startForeground(ONGOING_NOTIFICATION, notification) again with the updated information; however this flashes the notification on the bar each time it is called. What I would really like is the notification to quietly

Android - [Xoom/Honeycomb] application without LAUNCHER activity does not work

让人想犯罪 __ 提交于 2019-11-27 16:44:38
问题 I have an application without launcher activity that works properly from Android 1.5 to Android 2.3.4. It is started by my broadcast receiver. However, on Honeycomb (Motorola Xoom), my broadcast receiver doesn't work at all (it does not catch any intents). If I add launcher activity to my manifest: <activity android:label="@string/app_name" android:name="com.myapp.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent

android EditText blends into background

只谈情不闲聊 提交于 2019-11-27 16:33:51
问题 My app uses Theme.Holo.Light.DarkActionBar as the parent theme. When I use my Android 3.2 tablet emulator, the EditText shape is almost impossible to see. It looks like it is trying to draw white on white. Seen here: When I use it on my Android 4.0 tablet emulator, the EditText shape looks just fine. You can see the dark grey line along the bottom of the EditText. If you look in the above image, you'll just barely see a white line in the same place as it crosses the light grey background

Intent.putExtras size limit?

我只是一个虾纸丫 提交于 2019-11-27 16:13:28
I'm trying to pass data from one activity to another via Intent.putExtras like this: private ArrayList<HashMap<String, String>> mGroups = new ArrayList<HashMap<String, String>>(); private ArrayList<HashMap<String, String>> mUsers = new ArrayList<HashMap<String, String>>(); ... Bundle data = new Bundle(); data.putInt("mode", mode); data.putSerializable("groups", (Serializable) mGroups); data.putSerializable("users", (Serializable) mUsers); data.putInt("current_class", mCurrentClassId); data.putInt("current_user", mCurrentUserId); Intent intent = new Intent(ctx, ChildActivity.class); intent