Calabash-Android: Set system time to text field - android

I am testing a android app and want to add name to ListView. But I want it to auto generate name which make it unique in the list.
I tried and can add system date to CustomTextView with code below in console.
query("ClearableEditText id:'edt_event_name'", :setText=>`adb shell date`)
Then I want to paste these to .feature and .sh file but no idea to make it work.
Any idea please help!
Thank you

Related

How to display two or more logcat filters at the same time in Android Studio?

I have declared two LOG.i such as followings in my code:
Log.i("pen", pen.toString);
Log.i("book", book.toString);
Then I added these two filters to my Logcat window (via Edit Filter Configuration):
Filter1 with 'LOG TAG' set to pen
Filter2 with 'LOG TAG' set to book
I have no problem to see them each individually (by selecting them each in drop-down filter in logcat window).
NOW What I need to know is HOW to display both filters at the same time?
Have you tried using regex? Do as the screenshot below and you should see both tags at the same time
For copy/paste: (pen|book)
Note this accepts any number of tags as long as you separate them with |
Thanks for all responses, they all were really helpful, however I found what I was looking for, if you really do not want to create a new filter just copy and paste something similar (pen|book) to the Search box on the main logcat window and do not forget to tick Regex box next to it.
Via the Edit filter configuration, create or edit a filter with Log Tag(regex) (or check regex depending on the version of android studio) set to
pen|book
I can not take a screenshot now, I'm sorry.
Otherwise using the command line you can do (on linux)
adb logcat | grep -e book -e pen
Have you tried separating both values by coma or semi-colon or |?
LOG TAG: pen, book
or
LOG TAG: pen; book
or
LOG TAg: pen|book

Vserv appwrapper gives Failed message

I have an android app that I am trying to ad-wrap using the Vserv.mobi appwrapper. Below are the steps that I follow:-
Select 'Wrap Android'
Add the .apk file
Set Show At = Both
Entered the Zone ID & ZoneID end
Set View Mandatory = Can view
Set Cache = Yes
Kept all fields in Label section blank
In Advanced section set Block Ads=No and Location Ads=Allowed all other fields are blank
Set Code Signing=Self
Add keystore file, set alias name, set alias store password & set key password
Set the output folder path
Click on 'Wrap App'
However I always seem to get the 'Failed (1 out of 1)' message.
Log file does not give too much information either:-
"APK folder location path !!!Failed!!!"
Does anyone know how to find the specific reasons due to which the wrapping failed?

Android: resource String automatic generation

I'm new to Android. When I add a button/views in Graphical layout it adds the label text this way- android:text="Button" . Why doesnt it add "android:text="#string/my_label" and add a string resource in string.xml file. Can't it be done automatically in eclipse?
I have searched a lot but I have not get any automated way to add a string to the resource file But This will save your time a lot IMHO.
Select a String, click Refactor --> Android --> Extract Android String.
Thanks to Brent Hronik. CTRL-1 on Windows works fine.
Because you don't have to use the #string resource. The purpose of the #strings resource is to make it easier to change elements about your code. For example, if you are using your application title in mutliple places, let's say in every dialog box, then if you change the title you would have to change it in all the instances that the app title is being display. So in this instance the #string/App_Title could be set to "My Program" and all of the dialog boxes can reference that. If you change the title to "Hello World" then all of these are changed. The #strings resource, while eclipse tries, doesn't have to be used for every string. Not using it is the equivalent to hard coding the value. There are plenty of reasons for and against using #string for everything.
I am not sure if there is a setting in eclipse that will automatically add a string to the resource file when the control is added.
(EDIT: Based on other users CTRL+1 is the short cut to do this.)
You can add the string to the strings.xml by clicking command and 1(on a mac, assume it would be control 1 on a Windows or Linux box) simultaneously. This will add the resource to strings.xml and then open that up in the editor.
Thanks Siddiq Abu Bakkar! I didn't think it would be there.
On Eclipse (and Windows) the shortcut is:
Alt+Shift+A (release all and then press) S
When you use Eclipse for first time it's not easy understand how to use these kind of "complex" shortcuts.
I can't vote and i can't comment answers yet (missing reputation as i'm a new user)
But i confirm :
1) hard type the string in your code like
mydlg.setTitle("hello guys");
2) select your string (e.g : "hello guys")
3) press Alt + Shift + A then press S
a dialog will appear to let you add a new string into resources. Everything should be already filled into that dialog box.

Automatic Code Generation for Strings.xml from Eclipse

I find it a waste of time that every time I need to enter a string that I have to go edit the strings.xml file manually. What I'd like to be able to do ideally is have Eclipse pop up a dialog box that lets me specify the name of the resource and the value for it. Then Eclipse would generate the code in strings.xml and paste the correct reference to the string at the cursor position.
Does such a facility exist?
Select a String, click Refactor --> Android --> Extract Android String.

How to rename an Android app programmatically?

Some users want to rename my Android app to something else.
So I'd like to provide a text field for them to put in a new name inside my app.
Then how can I programmatically rename my app name to the new name?
You want to rename your app or change the title when application is running?
To change the title you have setTtle() funcion from activity.
If you want to change application name in string.xml you should have a value called app_name.
You have to rename it to the new value.
To do so you have to unzip the apk and modify the xml file and then repack it.
But making this way I think application have to be reinstalled.

Categories

Resources