intent

Jack Kornfield on karma related to speech, and intention

I’m not a huge believer in certain types of karma in this world, but Jack Kornfield offers this discussion about karma related to speech, and intention:

“Speech is one area in which karma can be seen in an easy and direct way. For this exercise, resolve to take two or three days to carefully notice the intentions that motivate your speech. Direct your attention to the state of mind that precedes talking, the motivation for your comments, responses, and observations. Try to be particularly aware of whether your speech is even subtly motivated by boredom, concern, irritation, loneliness, compassion, fear, love, competitiveness, greed, or whatever state you observe ... Simply notice the various motivations in the mind and the speech that flows from them.”

“Then, after discovering which motivation is present as you speak, notice the effect of the speech. If there is competitiveness or grasping or pride or irritation behind the speech, what response does it elicit from the world around you? If there is compassion or love, what is the response? If your speech is mindless, as if you were on automatic pilot, what is the response? If there is clarity and concern, how is this received and responded to?”

It brings up an excellent point: What motivates your speech?

How to make a phone call from your Android app

I came across this Android phone dialer tip yesterday. If you want to make a phone call from an Android application, all you have to do is create a new Intent, either an Intent.ACTION_DIAL (to start the call) or Intent.ACTION_CALL (to place the call).

Here are the three lines of source code you need to get started:

Intent dialIntent = new Intent();
dialIntent.setAction(Intent.ACTION_DIAL);
dialIntent.setData(Uri.parse("tel:8675309"));

Source code for an Android ViewPager example (Activity and Fragment)

This is a little unusual for me, but I'm putting the following code here so I can remember how I implement a ViewPager in my current Android application. I want to put this code out here in its current state before it gets more complicated. In fact, I only wish I had copied it out here earlier, before I made it as complicated as it is.

The only things that are important to know are:

Android: How to attach an extra to an Intent/PendingIntent in a Notification (solution)

I’m working on a very small Android “notifications” app where I a) display a notification using a background service, b) the user taps the notification, which c) takes them to a view that shows the full text of the notification. To get this to work, I need to send the full text along with the notification. However, this didn’t work easily. The text that was shown by my full view would be updated once, then never again.

After a lot of googling and trial and error, I finally got this approach in my sendNotification method working:

Making your Scala code more concise (and your intent more clear)

I was trying to write some code last night while I was very tired, and while the code itself isn't difficult in any way, the thought process I went through demonstrates how your code can become more concise as your understanding of Scala evolves, so I thought I'd share the experience here.

While working on my Sarah application, I was rewriting the Brain class, and I started off writing a method that looked like this:

Android: How to start/launch a new Activity alvin February 24, 2012 - 8:49am

Android FAQ: How do I start a new Activity in Android?

Typically I start a new Activity in Android like this: