Howto create a quick action bar/badge/Dialog

by David » Sat, 26 Jun 2010 17:22:13 GMT

Sponsored Links
 Hey everyone,

I watched the UI session on Google IO this year in which they showed
us the quick action dialogs used in the twitter App.
I really like the way they work and would like to include one in my
own App.
But even though I'm not a beginner I can't think of an efficient way
of implementing the dialog / badge / bar.

I tried looking at the implementation of the quick contact bage but it
is rather complex and hard to extract the essentials. And in the end
it's not really the same as the twitter one.

Does anyone have an example or is there any documentation of how to
create quick action bars?

Greets David


Howto create a quick action bar/badge/Dialog

by Mark Murphy » Sat, 26 Jun 2010 17:26:18 GMT


qberticus posted this the other day: 

Haven't played with it myself, and the look-and-feel is up to you.

Mark Murphy (a Commons Guy)  |  | 

Android 2.2 Programming Books: 


Sponsored Links

Other Threads

1. Activity and Interface

I've a problem to solve about pass reference between objects Activity.
Suppose follow situation with 3 class and 1 interface:

I don't know how pass the reference of MyEvents (_engine) to ActivityB
from ActivityA::StartActivityB()

public interface MyEvents {
        public abstract void MakeThis();
public class Engine implements Runnable, MyEvents {
        void Init(){
                _th = new Thread(this);
        public void run() {
        void MakeThis(){

public class ActivityA extends Activty {
        Engine _engine;
        public void onCreate(Bundle savedInstanceState) {
                _engine = new Engine();
                _engine.Init(); // start thread
        void StartActivityB(){
                Intent intent = new Intent(ActivityA.this, ActivityB.class);


public class ActivityB extends Activty {
        MyEvents _myEvent;

        ActivityB(MyEvents myEvent){
                _myEvent = myEvent;

        public void onCreate(Bundle savedInstanceState) {



2. moved Code: can't open a browser anymore (via FBRocket)


I'm trying to do a single query on Facebook. To do that, I'm using
FBRocket (  http://www.***.com/ ).
Everything worked fine when the code was located in my main Activity.
I however moved it to another class then:

package com.example.helloandroid;

import it.polimi.elet.context{*filter*}.microjena.rdf.model.Model;
import it.polimi.elet.context{*filter*}.microjena.rdf.model.Resource;
import net.xeomax.FBRocket.FBRocket;
import net.xeomax.FBRocket.Facebook;
import net.xeomax.FBRocket.LoginListener;
import net.xeomax.FBRocket.ServerErrorException;
import android.util.Log;

public class DPFacebook implements IBasicDataProvider, LoginListener {

        FBRocket fbRocket;
        Facebook fb;
        Activity callingActivity;

        public DPFacebook(Activity activity) {
                fbRocket = new FBRocket(activity, appname, key);
                callingActivity = activity;

        public void updateContext(Model contextModel, Resource
currentContext) {
        if (fbRocket.existsSavedFacebook()) {
         } else {
                        fbRocket.login(this, R.layout.main);

        public void updateData(Model targetModel) {
                // TODO Auto-generated method stub


        public void onLoginFail() {
                fbRocket.displayToast("Login failed!");
                fbRocket.login(this, R.layout.main);


        public void onLoginSuccess(Facebook arg0) {
                fbRocket.displayToast("Login success!");

                String query = "SELECT uid FROM user WHERE name=\"John Doe\"";
                String result;
                try {
                        result = arg0.fqlQuery(query);

                        if (result != "")
                                Log.v("FB", result);

                } catch (ServerErrorException e) {
                        // Check if the exception was caused by not being 
                        if (e.notLoggedIn()) {
                                // ...if it was, then login again:
                                fbRocket.login(this, R.layout.main);
                        } else {

However, when I reach the login(), nothing happens. When I had the
code in the main activity, it opened the Facebook Connect login
interface in a browser. Now I don't get any errors, exceptions or

Is is possible that my class lacks a permission to open a browser or

Thanks for your help,

3. Icons revisited

4. No stats? 0 total; 0 active installs while 5000 AdMob impressions??

5. dynamic receiver enable/disable?


7. How to make any service running automatically when the phone is turned on.