Robotium - Trying to go click through menu - android

I have a menu in my app that i am trying to iterate trough. The menu consists of more than 10 items, but i only want to test the first 5 items (which i can select with either index or based on text).
I am looking for a generic solution that will
select menu item 1
do a text check
select main menu
select menu item 2
do a text check
select main menu
etc
However i also need to execute this on multiple devices with different screen sizes, so it has to scroll to the menu item in case its not yet visible on screen.
I've tried using different solutions from these boards, but i have not been able to succeed yet.
Any help would be greatly appreciated.

The issue here is because of a bug in robotium that was fixed after the latest release. The issue in question is https://code.google.com/p/robotium/issues/detail?id=550
The latest code on github does have this fix in (see here, so you could package the source yourself and use that as the latest version otherwise you are going to have to implement some methods that have the same functionality as that changed.
Edit
Robotium 5.0.1 is now available and should have the above fix in it.

Related

Listview, scrollToItem does not work properly in android in appcelerator

I am trying to implement a screen in Appcelerator, where there are tabs in one view and the other view contains a listview with list sections. On the click of every tab, the respective section and section heading should scroll up. Say, I click on the third widget, the third list section and its section heading should scroll up. I have used the scrollToItem property for this. It works fine on iOS, but doesn't align properly when executing on the android devices. Any suggestions?
It's a bug in Android 4.x, this method would not scroll to correct position when you are running the app on Android 4.x. You can have a look at the Appcelerator docs : http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ListView-method-scrollToItem
So if it is an appcelerator bug then, thumbs down we will need to look for some other options or work around to solve the problem (Maybe a Widget or Module if you want to go specifically with the listView).
Or else, you could use the TableView, as it also has a method scrollToIndex, only thing you cannot add animation in android in this.
Good Luck & Cheers

ADT eclipse GUI problems

It doesn't fully load the GUI, I can't create new layouts. It doesn't generate any source files, even when I create a new activity. I have downloaded it several times, but I can't get it fully working. I've used eclipse before, I'm no stranger to it. The ADT I downloaded bugs as hell. I tried 32&64 bit, both didn't work. Here is a link to the ADT
To unhide a menu item or toolbar button:
Switch to the perspective that you want to configure.
Select command link Window > Customize Perspective....
Open the Menu Visibility or Tool Bar Visibility tab.
Find the item you want to hide. You can do this two ways:
Expand the menu or toolbar hierarchy to find the item you want to hide.
Click the Filter by command group check box to see a list of command groups which contribute items, and choose the command group the item you wish to hide. Then navigate to the item in the hierarchy in the Structure tree.
Hover over the item to get additional information:
a description of what the item does
the name of the command group which contributes the item (click the link in this item to switch to the Command Groups Availability tab with the appropriate command group selected).
any key bindings associated with the command the item performs (click the link in this item to open the Keys page of the Preferences dialog with the command selected, if possible).
if the item is dynamic, a preview of its current appearance (dynamic items are listed as [Dynamic]).
Check the check box next to the item. Uncheck a menu to hide all its children.
Click OK to cause the changes to take effect.
There are indeed some very annoying bugs in the latest ADT. I had the exact same problem. The simple solution would be to manually update your ADT plugins from Eclipse, but unfortunately, it's not so easy for most people. You can find all of the solutions (and solutions to the failed solutions) here.
If you don't want to try solution after solution, just do what I did and download Eclipse Juno, the ADT plugins and the SDK separately. If it's still not creating files or if it's giving you errors, you may have to clean the workspace and/or import some jar files.

Android Studio - just can't get action bar / overflow to work?

I'm using Android Studio (actually on Mac), only using real devices
This is 4.1+ only. All projects created from fresh.
CHECK - I did load support and appcompat, as best as I can understand Gradle. [A]
CHECK - onCreateOptionsMenu, etc, looks good...
CHECK - xml is good to go. (I do totally understand the showAsAction options, and tried them all.) [B] Regarding using text or an icon, I tried all permutations.
So what happens?
When I run it on a device (10+ tested). It simply shows as many action bar items as can fit (say, 5 or so). Rotation etc. works perfectly.
But it just will not show the overflow icon!! WTF?? It simply does not show, anywhere, the missing three or four items.
I have tried all this with both "Blank Activity" and "Fullscreen Activity". No matter WHAT I do, it won't show the ##$# overflow.
It's almost like the icon is just not available in the build or something??
Can any Android friends psychic this problem? It's a really "WTF" moment. Thanks in advance.
My workaround ... https://stackoverflow.com/a/22855136/294884 That works great, but you Android guys would laugh at me doing that.
[A]: (Note that I have two build.gradle files; I did it on the inner one inside app/ . Wouldn't work on the outer one.)
[B]: (Note, a common question seems to be when people don't get the difference between 'always' and 'ifRoom'. TBC that is not my problem at all: my problem is the #$## overflow simply will not appear!!)
BTW for anyone new to Android ...
https://stackoverflow.com/a/16046189/294884
that extended discussion may be very useful.
Press "File" in the top left corner of Android Studio, select "Project Structure...". A Dialog will be opened with a list of modules in the left side.
Select the module of your project, go to the tab "Dependencies", press the green "+" on the right, select "Library Dependencies" in the next Dialog you will be able to add the libraries you want.
If "Support v4" and "AppCompat" are not available you should first install "Android Support Library" and "Google Repository" via the Android SDK Manager.
That will be my best guest. Devices with hardware button don't show the 3-dots menu.
Also if the project is 4.1+ you don't need neither support-v4 nor appcompat-v7. Those might be causing some conflict.
Link to Google explanation on buttons on different devices:
http://developer.android.com/design/patterns/compatibility.html
Regarding using the build.gradle file or the dialog, well, probably yes, but I'm already used to the gradle file and never even look at the dialog, but I'm just old school.
Result!
Found Dirty Hack to force the overflow icon to be visible on devices which have the hardware menu button.
private void getOverflowMenu() {
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if(menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Source:http://www.tagwith.com/question_264107_overflow-menu-not-showed-at-action-bar
I had similar problems showing action bar icons when starting to use Android Studio..
Strange that when I looked at the layout in the design screen it did showed the icons properly but when I tried to run the app both on actual device or on the emulator it showed 3 dots instead.
I do know that even on devices that have HW setting button I still see applications that shows action bar icons and not 3 dots.
Finally the only thing that helped was to do this:
// compile 'com.android.support:appcompat-v7:21.0.0'
I comment this library dependency in the gradle that fixed the problem.
I have the Something like this, when i moved my project to android studio, all action bar items instead if being displayed on the action bar, they only appear as text when pressing the hardware button menu, and when run on nexus, the three dots appear in the corner of the action bar !
i tried things suggested on this page, but had no success in showing the items on the action bar !

How to get a Android menu drop down like the one in Wash Post app?

I want to create a similar drop down menu using the grid button on the top right corner like the one the Wash Post android app.
I went through the web. But could find any answers, as I am new and really don't know what keywords to search with.
The library ActionBarSherlock is able to do that in targets below Android 3.0 - it's available since Honeycomb via the normal menu mechanism.
If you want your items to appear in that dropdown - just define the right flag
SHOW_AS_ACTION_NEVER

android button widget with a dropdown list, what is the name of this particular widget?

Im learning android layouts and Ive noticed a particular button widget in some android apps that I would like to add to my own apps, Im just not entirely sure what its called, In some cases this button widget even will include a dropdown list here are a few examples of what Im talking about.
in the first image you will notice that the checkmark, the camera and the pencil are all sitting inside of the button widget i'm after, and in the youtube app you will notice the thumbs up, thumbs down and more buttons
That's ActionBar. Native support for 3.0+ devices, and some work to do in pre 3.0-devices. You can find example in new api 14 samples(called "ActionBarCompat").
Please see my answer here which gives some good links on how to implement the "dashboard" pattern, and use the "quickaction" bar. I think this should put you on the right path. Also there is a link on how to implement the "action bar."
EDIT: According to Mighter, if you use API 1.6 - 2.3 there should be official Google samples for this now. Please see this.

Categories

Resources