When working with ORMlite it’s very helpful to see the SQL statements.
This can be easily done using adb shell:
adb shell setprop log.tag.StatementExecutor VERBOSE
adb shell setprop log.tag.BaseMappedStatement VERBOSE
adb shell setprop log.tag.MappedCreate VERBOSE
adb shell setprop log.tag.ORMLite DEBUG
More information is available at http://ormlite.com/javadoc/ormlite-core/doc-files/ormlite_4.html
We are excited to take part in the first GZMoMo!
The event will connect industry professionals, factories, designers and anyone interested in the mobile space.
See the website for details.
In a recent project, I had to implement a small status text overlay on top of a avatar image.
The requirement were to have it display 4 lines at most and use the space most efficiently.
My first thought was to start calculating margins, text widths and padding etc. Luckily, Android provides a class called android.text.StaticLayout.
Unfortunately, it doesn’t provide a setMaxLines(int) function that could be used, therefore the line limitation was solved by using clipRect on the canvas.
// bmp1 is a source bitmap (in that case 44x44px big).
// density is the screen density, you will need to retrieve it yourself as well.
canvas.drawBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.overlay_44x44), new Matrix(), null);
// Initialize using a simple Paint object.
final TextPaint tp = new TextPaint(WHITE);
// Save the canvas state, it might be re-used later.
// Create a padding to the left & top.
// Clip the bitmap now.
canvas.clipRect(new Rect(0, 0, bmp1.getWidth(),(int) (bmp1.getHeight() - (6*density))));
// Basic StaticLayout with mostly default values
StaticLayout sl = new StaticLayout(message, tp, bmp1.getWidth(), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
// Restore canvas.
UPDATE: This class is now available on Github & Maven. Please see https://github.com/ened/Android-MarqueeView for details.