This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//inside a fragment. If in an Activity you could use findViewById(Window.ID_ANDROID_CONTENT); | |
getView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() | |
{ | |
@Override | |
public void onGlobalLayout() | |
{ | |
//do something like measure a view etc | |
View content = getWindow().findViewById(Window.ID_ANDROID_CONTENT); | |
Log.d("DISPLAY", content.getWidth() + " x " + content.getHeight()); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These commands will help you setup the Rails test environment without problems | |
# | |
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads | |
# | |
# Copy paste all of following commands in your normal terminal and the following things will happen: | |
# - rails_test_box dir is created | |
# - rails master branch is checkout in the dir rails | |
# - A Gemfile is created and all the gems to run the virtualbox are installed using bundler | |
# - The rails vagrant box is downloaded and added to your vagrant boxes | |
# - A Vagrantfile is created for vagrant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blog = Blog.create | |
post = blog.make_post text: 'great post', location_country: 'Canada', location_city: 'Toronto' | |
post.make_comment text: 'great comment', location_country: 'Canada', location_city: 'Toronto' |