Home > Tricks & Tips > Launch an activity

Launch an activity

This is how you can launch an activity:

	public static boolean launchApp(Context c, PackageManager pm, String pkgName) {
		// query the intent for lauching
		Intent intent = pm.getLaunchIntentForPackage(pkgName);
		// if intent is available
		if(intent != null) {
			try {
				// launch application
				// if succeed
				return true;

			// if fail
			} catch(ActivityNotFoundException ex) {
				// quick message notification
				Toast toast = Toast.makeText(c, "Application Not Found", Toast.LENGTH_LONG);
				// display message
		// by default, fail to launch
		return false;

Just customize and make use of it.
Hope you enjoy!

Pete Houston

Categories: Tricks & Tips Tags: , , ,
  1. May 27, 2016 at 9:44 pm

    Commo montar um curгículo s dе camіnhoes papel de parede
    dе gaame related:/piadas/ theme hospitaⅼ playstation1 ɗownload histoire de metz /memoria/historia/gov88975/mena_barreto.html privateonlіne.

  2. March 23, 2016 at 1:59 pm

    Whats up very cool website!! Guy .. Excellent .. Superb .. I will bookmark your site and take the feeds also…I’m glad to find numerous helpful information here within the post, we want work out extra techniques on this regard, thanks for sharing.

  3. November 18, 2015 at 9:02 pm

    hi!,I love your writing very much! proportion we keep in touch more about your article on AOL?
    I require a specialist in this house to unravel my
    problem. May be that’s you! Taking a look ahead to peer you.

  4. September 21, 2013 at 2:15 pm

    When I originally commented I clicked the “Notify me when new comments are added” checkbox
    and now each time a comment is added I get several e-mails with
    the same comment. Is there any way you can remove me from that service?
    Many thanks!

  5. July 14, 2013 at 3:30 am

    Unquestionably believe that which you stated. Your favorite reason seemed to be on the internet the easiest thing to
    be aware of. I say to you, I definitely get irked while people
    think about worries that they just don’t know about. You managed to hit the nail upon the top and defined out the whole thing without having side effect , people could take a signal. Will likely be back to get more. Thanks

  6. June 22, 2013 at 6:35 pm

    First off I want to say fantastic blog! I had a quick question which I’d like to ask if you do not mind. I was interested to find out how you center yourself and clear your mind before writing. I have had a hard time clearing my mind in getting my thoughts out there. I truly do enjoy writing however it just seems like the first 10 to 15 minutes tend to be lost simply just trying to figure out how to begin. Any recommendations or tips? Many thanks!

  7. June 22, 2013 at 6:21 pm

    Good information. Lucky me I ran across your site by chance (stumbleupon).
    I’ve saved it for later!

  8. May 11, 2013 at 11:14 pm

    What’s Going down i am new to this, I stumbled upon this I have discovered It absolutely helpful and it has aided me out loads. I am hoping to give a contribution & help different users like its helped me. Great job.

  9. May 11, 2013 at 5:13 am

    Yesterday, while I was at work, my sister stole my iphone and tested to see
    if it can survive a 40 foot drop, just so she can be a youtube sensation.
    My iPad is now broken and she has 83 views.

    I know this is totally off topic but I had to share it with someone!

  10. April 13, 2013 at 11:42 pm

    Greetings! I know this is kinda off topic but I was wondering which blog platform are you using for this website?
    I’m getting tired of WordPress because I’ve had problems with hackers and I’m looking at alternatives for another platform. I would be great if you could point me in the direction of a good platform.

  1. May 25, 2012 at 2:34 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: