How to start others application in Widgets click event ?


Last Updated:

  1. wong0421

    wong0421 New Member This Topic's Starter

    Joined:
    Aug 6, 2010
    Messages:
    2
    Likes Received:
    0
    I designed a widget and successful using "setOnClickPendingIntent" to active the click event, but I want to start other application witch is install in my Android phone (such as Google Map), how can I using in this following command?

    if (intent.getAction().equals(ACTION_WIDGET_CLICK)) { .... }

    Beside that, My widget is a clock widget, I want to click a button to start the "system clock page" and click the date to the system Calendar. How can I make it? many thanks!
     

    Advertisement
  2. blundell

    blundell Well-Known Member

    Joined:
    Apr 23, 2010
    Messages:
    125
    Likes Received:
    17
    Here's a little hint to get you started:
    Code (Text):
    1.  
    2. Intent intent = new Intent(Intent.ACTION_VIEW);
    3. intent.setDataAndType(path, "application/pdf");
    4. intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    5.  
    6.  
    7. try {
    8.     startActivity(intent);
    9. }
    10. catch (ActivityNotFoundException e) {
    11.     Toast.makeText(OpenPdf.this,
    12.         "No Application Available to View PDF",
    13.         Toast.LENGTH_SHORT).show();
    14. }
    15.  
    App Intents

    Starting Google Maps Activity
     

Share This Page

Loading...