4th June 2009, 12:15 am
Hi, everyone,
I’m Jason Alderman, a partner-in-crime of Matthias on Android hacking projects, and I’ll be guest-blogging here every now and then. (Thanks much, Matthias.)
Google hosted I/O in San Francisco last week, an intense (see post title!) developer-centric two-day conference on hacking with Google technologies. As was the case last year, there were a lot of sessions on Android, and Google will be posting videos of those sessions to YouTube Thursday. I was lucky enough to make it out to I/O, score one of the new Ion dev phones, and sit in on nearly all of the Android sessions.

Most of the sessions were VERY engineering and dev centric… as one might expect from a Google conference. Here’s a run-down of the Android keynote and sessions, before the videos are all live on the I/O site…. Continue reading ‘Google I/O was a firehose of learning.’ »
10th February 2009, 10:24 pm
These are my links for February 3rd through February 10th:
3rd February 2009, 08:04 am
These are my links for January 26th through February 3rd:
30th January 2009, 08:47 am
In addition to Android, I also do work in WPF and Silverlight. In that capacity, I discovered that there is a Twitter list for WPF and Silverlight developers. That list was based on a Twitter list of iPhone developers. A quick search revealed that there is no similar list for Android developers.
Well there is now.
I’ve put together the list, which is viewable here. You can add yourself to the list with this form.
I also cannibalized the ruby script for adding everyone on the list en-mass into your Twitter feed. You can download the script here. For further instructions, check out devinsblog.
Oh… and if you’re interested, my Twitter feed is matthiasshapiro.
26th January 2009, 10:53 pm
This is a really basic, super dumbed down tutorial for 2D drawing in Android. If you’ve never done it before, this might help. If you’ve ever done it before… you already know this stuff.
And with that out of the way… start a new Android project and put the following into the onCreate method:
setContentView(new MyDrawableView(this));
Near as I can tell, if you want to do any graphics-type drawing in Android, you need to get some level of access to the onDraw method, which resides in the View class. But this means you need to create a new view class. So… create a new class and name it “MyDrawableView”. You should end up with something like this:
public class DrawableView extends View{
Context mContext;
public DrawableView(Context context) {
super(context);
mContext = context;
}
}
Now, lets add an override for our onDraw method:
@Override
protected void onDraw(Canvas canvas){
Paint myPaint = new Paint();
myPaint.setStrokeWidth(3);
myPaint.setColor(0xFF097286);
canvas.drawCircle(200, 200, 50, myPaint);
canvas.drawBitmap(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.icon), 184, 184, null);
invalidate();
}
What we’ve done here is nothing more than draw a circle and place the application icon in it. The Canvas object holds all the drawing calls (read more about it here) and the draw objects are layered one on top of another in the order that they are called. The “invalidate” method at the end forces a draw on the canvas.
I would provide source code, but I really can’t do much more than recommend that you take a look at source code over at anddev.org for a similar tutorial. They also glance at some very simple procedural animation, so it is definately worth your time if you’re looking a little deeper into basic Android drawing.
26th January 2009, 09:13 am
These are my links for January 26th:
25th January 2009, 04:27 pm
These are my links for January 24th:
2nd December 2008, 06:03 am
This one is really easy.
I’ve been working the last couple weeks with a small crew of developers under the name “Math In Pulbic” developing small math related products for Android. With a name like “Math In Public”, one of the first things we wanted to do was make it so that we could have text entry fields that accepted only numbers. Being somewhat new to Java, I was surprised at how easy this was.
Basically, just grab your EditText widget and add a NumberKeyListener as the default key listener:
MyEditText.setKeyListener(new NumberKeyListener(){
@Override
protected char[] getAcceptedChars() {
char[] numberChars = {‘1′,‘2′,‘3′,‘4′,‘5′,‘6′,‘7′,‘8′,‘9′,‘0′,‘.’};
return numberChars;
}
});
The getAcceptedChars() method allows you to select specifically which characters you want to allow. So you could allow basic mathematical functions (+, =, -, /, *, etc) with this method as well.
26th November 2008, 10:38 am
I’m working on an app that has picture-taking functionality, and these look good. Note to self to check it out later:
Tutorial on Camera Capture with Source Code
How to create and use the SD Card with the Android Emulator
24th November 2008, 07:54 pm
OK, so you want to do something with the Android camera, but everytime you pull it up, it has auto-rotated the image 90 degrees and skewed it. And you don’t like this one little bit.
There is help, my friend.
Basically, if you’ve walked yourself through this Camera Preview tutorial and you can’t seem to get your image to display properly in portrait mode (when the keyboard is closed), it’s because the camera is basically hard wired to work in landscape mode (when the keyboard is open).
The simple fix to this is to add this line of code to your opening activity.
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
This will force a render in landscape mode even though the keyboard is closed. And your problem is solved.