Profile cover photo
Profile photo
Gregory Meiste

Post has shared content
This looks useful! I'll have to remember this the next time I'm creating Android layouts.
Percentage Based Dimensions and Margins with the Percent Support Library
Pro-tip by +Joanna Smith

There are a lot of options to help you position your Views just right. But adding a LinearLayout to your beautiful RelativeLayout just to gain access to layout_weight for that perfect positioning is ridiculous. And we hear you on that. Which is why Android introduced the new Percent Support Library ( Its PercentFrameLayout and PercentRelativeLayout provide an easy way to specify View dimensions and margins in terms of a percentage of the overall size.

That means if you want a view to take up exactly 50% of the available width and height, you’d use a layout such as
  app:layout_heightPercent="50%" />
  app:layout_marginEndPercent=”25%” />

Note that we use layout_marginStartPercent/EndPercent to set a margin based on a percentage of the total width.

Fun fact: if the percentage you set is more of a guideline than hard limit, you can also set layout_width/height=”wrap_content” in addition to layout_widthPercent/heightPercent and Views larger than the allowed percentage value will instead be resized using wrap_content rules.

So check out the Percent library today and use this efficient layout to #BuildBetterApps  
Add a comment...

Looks great on my Moto 360! Much better than other watch faces I've seen/used. One thing that does look strange is the notification overlay when the screen is dimmed. The message text is placed directly on top of the watch face. I prefer how the "minimal" watch face handles this case. It adds a transparent background to the notification, giving the appearance that the notification is on top of the watch. It's subtile, but to me really helps the readibility of the notification text.

Other than that, I'm very pleased. Kudos!

Post has shared content
Sweet! Can't wait to give this a try!
Call me maybe? Free voice calls via Hangouts, now available on Android, iOS and the web →
Add a comment...

Post has shared content
New release now available! Get it while it's hot!
On January 16, 2012, development began on Pick The Winner. Later that year, on July 18, 2012, we published Pick The Winner 1.0 on +Google Play. Almost exactly two years later, we're pleased to announce Pick The Winner 3.4.0 (our 14th release)!

Changes in this release include:
- Questions screen will now continue to show current race after the #NASCAR  race has started to make it easier for players to check how they answered questions while the race is in progress.
- Now can swipe between race detail screens (only on #Android  4.1 and later).
- Switch to Android standardized pull-to-refresh UI.
- Many improvements under the hood.
- Fixed rare app crashes seen by some users.

The minimum requirement is +Android 2.3.3 or later. Please note that this release is the last planned release that will support Android 2.3 and 3.x. Barring any bugs, our next release will only support Android 4.x or later. More details to follow.

Pick The Winner 3.4.0 will be available on Google Play shortly. Instead of answering questions this week (it's an off week), please download and enjoy the new release!

#androidapps   #androidgames  
Add a comment...

Post has attachment
Stumbled across this article today. It finally explained the proper use of Android's LayoutInflater to me.

Add a comment...

Post has attachment
Fellow Android Developers! I have a StackOverflow question for you. Your help is appreciated. :-)

Post has attachment
Fellow Android Developers! I have a StackOverflow question for you. Your help is appreciated. :-)

#androiddev   #android  
Add a comment...

Post has shared content
Can you spot the defect before reading the answer?
Writing correct concurrent Java code is hard

See if you can spot what's wrong with this code I came across today, simplified here*:

class Foo {
Boolean myFlag = Boolean.valueOf(false);

void foo() {
  synchronized(myFlag) {
    myFlag = Boolean.valueOf(true);

void bar() {
  synchronized(myFlag) {
    myFlag = Boolean.valueOf(false);

Let me first provide a brief explanation of how the synchronized statement works in Java. Every Object has an intrinsic lock associated with it. The synchronized statement obtains the lock associated with the object, runs the code inside the block, then releases the lock.

In this case, the synchronized statement obtains the lock associated with the object in the "myFlag" field. The programmer has recognized that you can't lock over a primitive type (boolean), so has opted to use Boolean (which is a subclass of Object).

There are two things wrong in this example:
1) the value of the "myFlag" field is reassigned. In this case, it has one of two values: Boolean.TRUE and Boolean.FALSE.
2) if any code running in any thread also locks over either of these easily accessible values, the code running from this class is affected.

Three rules to prevent this mistake in your own Java code:
1) If possible, use synchronized methods instead of synchronized statements (they're simpler)
2) Only lock over fields marked as final, or the "this" object.
3) Create separate lock objects for fields that need this block, and in your source file, write a comment stating that as a contract. For example:
private final Object myFlagLock = new Object();
private boolean myFlag = false; // must synchronize on "myFlagLock".

In this case, an AtomicBoolean would work quitenicely, too:
private final AtomicBoolean myFlag = new AtomicBoolean(false);
synchronized(myFlag) {

I've noticed that IntelliJ provides an inspection for this simple mistake. I can't recommend IntelliJ enough.

Read more about the synchronized statement/block here:

Get the fantastic "Java Concurrency in Practice" book by +Joshua Bloch and others:

* Full code was from the Pebble SDK examples, found here:

#java   #concurrency  
Add a comment...

Post has attachment

Post has shared content
The 2014 update for Pick The Winner is here! Get it while it's hot!
Happy New Year! Are you ready for the upcoming #NASCAR  season? We are! The Sprint Unlimited is only a month away. To celebrate, today we're excited to announce Pick The Winner version 3.2.0 for #Android . It is a big update: 224 changed files with 3,713 lines of additions and 5,340 deletions! Here is what is new:

- Multi-device support! Now changes you make to your account (answer submissions, player name, friends) are immediately reflected on all your devices. This feature is not available to everyone right away and is rolling out gradually to all players. To speed it along, after upgrading to version 3.2.0, you can sign into your account again on all your devices and the app will take care of the rest.

- Tablet layout for Questions tab. Players with 10" tablets will now have a multi-pane screen for questions, making better use of the available screen size.

Smaller changes include:
- 2014 schedule included by default.
- Add track’s city and state to Race Details screen.
- Improve data usage of widget
- Support for Android 4.3 and 4.4
- Added link to our Google+ page
- Several minor bug fixes

Minimum supported version is +Android 2.3.3 or later. It will be available on +Google Play shortly.

Not yet a player? Think you know NASCAR? Download the "Pick The Winner" app today and prove it!

#androidapps   #androidgames  
Add a comment...
Wait while more posts are being loaded