android-3.0-honeycomb

How to add submenu items to ActionBar action in code?

痞子三分冷 提交于 2019-11-27 10:31:31
Via xml I can add submenu items to my action in the ActionBar . main_menu.xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_new_form" android:icon="@drawable/ic_new_form" android:title="@string/menu_new_form" android:showAsAction="ifRoom|withText"> <menu> <item android:id="@+id/form1" android:icon="@drawable/attachment" android:title="Form 1" android:onClick="onSort" /> <item android:id="@+id/form2" android:icon="@drawable/attachment" android:title="Form 2" android:onClick="onSort" /> </menu> </item> </menu

Unable to resolve host “<insert URL here>” No address associated with hostname

不打扰是莪最后的温柔 提交于 2019-11-27 10:05:16
问题 I tried following this tutorial: Getting Data from the Web I tried implementing it on Android 3.0, the latest platform for tablets, however, I get this error: " Unable to resolve host "www.anddev.org" No address associated with hostname. " You can checkout the URL that I used just to prove that the file exists. http://www.anddev.org/images/tut/basic/getdatafromtheweb/loadme.txt I created a private class and extended it with asynctask. Here is the code: private class Downloader extends

Android Action bar custom dropdown view on item click

ε祈祈猫儿з 提交于 2019-11-27 09:54:28
问题 I'm writing an Android app for tablets. I've gone with the action bar to create my icons. However, I need to open a custom view when one of the menu items is clicked. I don't want a custom action bar - I need to inflate a custom view when the "Browse Subjects" action bar item is clicked. This view will need to appear like a dropdown but be using my own custom layout as it will not be used for navigation. Here is my menu.xml <menu xmlns:android="http://schemas.android.com/apk/res/android">

Appwidget size calculation

感情迁移 提交于 2019-11-27 09:33:18
问题 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

Android GridView with categories?

蹲街弑〆低调 提交于 2019-11-27 08:13:46
Is it possible to use categories or some sort of headers with a GridView in Android? I put together a quick illustration of what I was thinking about: Thanks a lot. You can use Stickygridheaders library directly or as a model to create your own widget. probably this code will help you. This is SectionedGridRecyclerViewAdapter, result looks like this: I think You can do it but you have to implement Jeff Shrkey's SeparatedListAdapter There isn’t an easy way of creating these separated lists, so I’ve put together SeparatedListAdapter which does it quickly. To summarize, we’re creating a new

Is there a method that works like start fragment for result?

耗尽温柔 提交于 2019-11-27 06:46:59
I currently have a fragment in an overlay. This is for signing in to the service. In the phone app, each of the steps I want to show in the overlay are their own screens and activities. There are 3 parts of the sign-in process and each had their own activity that was called with startActivityForResult(). Now I want to do the same thing using fragments and an overlay. The overlay will show a fragment corresponding to each activity. The problem is that these fragments are hosted in an activity in the Honeycomb API. I can get the first fragment working, but then I need to startActivityForResult()

VerifyError deploying on API 1.6

时间秒杀一切 提交于 2019-11-27 05:46:18
问题 I've come across a backwards compatibility issue when deploying my application on android 1.6. Im getting a VerifyError on this piece of code: if(android.os.Build.VERSION.SDK_INT >= 11) { getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg)); } This is not unexpected since getActionBar() doesn't exist pre API 11, however post-1.6 (API 5 and higher?) builds all semi-gracefully go around this according to the logcat message im getting when deploying for

Handling the missing MENU button in new versions of Android (3.x and up)

一个人想着一个人 提交于 2019-11-27 05:38:41
问题 I'm a fan of the menu button as used in Android <3.0, as it was very useful for my game apps - it allowed me to take important but gameplay irrelevant functionality (saving game, reference info links) and place it somewhere where it did not clutter up the main game interface, but was still easily accessible (the options menu). This use of keys became a problem with 3.0, because it removed the MENU button and substituted it with the Action Bar. The Action bar is really not suitable for a game

How to dismiss keyboard in Android SearchView?

喜你入骨 提交于 2019-11-27 05:38:27
问题 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

Tap outside Android dialog to dismiss it?

穿精又带淫゛_ 提交于 2019-11-27 05:14:53
问题 I was wondering if it's possible to somehow tap outside a popup dialog (or an Activity with a dialog theme), and dismiss it by just tapping outside of it? I made a quick picture to illustrate it: Normally, you have to press the back key to dismiss the dialogs, but on Honeycomb it could be great to have the option of just tapping outside the dialog, due to all the screen estate. 回答1: My app is a single activity with Theme.Holo.Dialog. In my case the other answer did not work. It only made the