view

How to draw a circle in Android (onDraw method in View)

Android FAQ: How do I draw a circle in Android?

To draw a circle in Android you just need to create your own View class and then use that in your Activity. For example, the following CustomView shows how to extend a View and draw a circle in the onDraw method:

Android: How to look up a widget (defined in XML layout file) by its id

Android FAQ: How do I look up (find) a widget in my Java code that I’ve defined in an XML layout file?

Solution: When you define your Android widgets in XML and then need to find a widget by its id, the method you need is named findViewById.

For example, you’ll use code like this to look up a widget by its id and create it in your Java code:

Scala: How to find the keys that are common to two maps

As a quick tip, this method shows one way you can find the keys that are common to two Scala Maps:

/**
 * Find the list of keys that are common to two Maps.
 */
def commonMapKeys[A, B](a: Map[A, B], b: Map[A, B]): Set[A] = a.keySet.intersect(b.keySet)

Important Sencha Touch 2 concepts for the new developer

Getting started with Sencha Touch 2 is kind of a pain in the rump. Having gone through this experience over the last few weeks, I've found that it really helps if you know about some Sencha Touch concepts that are hidden in the Sencha documentation.

Without any further introduction, here are the concepts that I really struggled with.

Create a Drupal table list view from a Drupal module

Drupal table view FAQ: How do I create a simple Drupal table view in Drupal module? I want to create a simple "list view", the sort of list view you might see in a simple CRUD application.

I just ran into this Drupal "table list" problem while creating a Drupal module, and after a lot of digging around, I found a formula that lets me display a Drupal table view like this:

Drupal block/view tip - How to insert a block or view into your content area ($content)

Drupal block/view FAQ: How do I insert a Drupal block or Drupal view into my HTML content area ($content)?

There are several different approaches to this problem, depending on what you really want to achieve.

Insert a Drupal view into your HTML content

If you really want to include a Drupal view into your Drupal content, you can use the Insert View filter, as described on this Inserting Views page on drupal.org.