Example usage for android.app Activity getIntent

List of usage examples for android.app Activity getIntent

Introduction

In this page you can find the example usage for android.app Activity getIntent.

Prototype

public Intent getIntent() 

Source Link

Document

Return the intent that started this activity.

Usage

From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteSchedulesDaySailingsFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    Bundle args = activity.getIntent().getExtras();
    mDates = args.getString("date");
}

From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java

static boolean updateButtonBar(Activity a, int highlight) {
    final TabWidget ll = (TabWidget) a.findViewById(R.id.buttonbar);
    boolean withtabs = false;
    Intent intent = a.getIntent();
    if (intent != null) {
        withtabs = intent.getBooleanExtra("withtabs", false);
    }//from w w  w. j a va  2  s .  co m

    if (highlight == 0 || !withtabs) {
        ll.setVisibility(View.GONE);
        return withtabs;
    } else if (withtabs) {
        ll.setVisibility(View.VISIBLE);
    }
    for (int i = ll.getChildCount() - 1; i >= 0; i--) {

        View v = ll.getChildAt(i);
        boolean isActive = (v.getId() == highlight);
        if (isActive) {
            ll.setCurrentTab(i);
            sActiveTabIndex = i;
        }
        v.setTag(i);
        v.setOnFocusChangeListener(new View.OnFocusChangeListener() {

            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                    for (int i = 0; i < ll.getTabCount(); i++) {
                        if (ll.getChildTabViewAt(i) == v) {
                            ll.setCurrentTab(i);
                            processTabClick((Activity) ll.getContext(), v,
                                    ll.getChildAt(sActiveTabIndex).getId());
                            break;
                        }
                    }
                }
            }
        });

        v.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                processTabClick((Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId());
            }
        });
    }
    return withtabs;
}

From source file:org.selfkleptomaniac.mod.titwilio.TwilioandroidModule.java

@Override
public void onResume(Activity activity) {
    Log.d(TAG, "on Resume");
    if (this.args != null) {
        createPhone(this.args);

        Intent intent = activity.getIntent();
        Device device = intent.getParcelableExtra(Device.EXTRA_DEVICE);
        Connection connection = intent.getParcelableExtra(Device.EXTRA_CONNECTION);
        if (connection != null) {
            Log.d(TAG, "resume & connection");
            intent.removeExtra(Device.EXTRA_DEVICE);
            intent.removeExtra(Device.EXTRA_CONNECTION);
            phone.handleIncomingConnection(device, connection);
        } else {// w  w w. j  a  v a 2s.com
            Log.d(TAG, "we have no way to handle incoming connection");
        }
    }
    super.onResume(activity);
}

From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java

static void updateNowPlaying(Activity a) {
    View nowPlayingView = a.findViewById(R.id.nowplaying);
    if (nowPlayingView == null) {
        return;//from  w ww  .  j  a v a2 s .c  o  m
    }
    boolean withtabs = false;
    Intent intent = a.getIntent();
    if (intent != null) {
        withtabs = intent.getBooleanExtra("withtabs", false);
    }
    //tinha um true == Music...
    if (MusicUtils.sService != null && MusicUtils.sService.getAudioId() != -1) {
        TextView title = (TextView) nowPlayingView.findViewById(R.id.title);
        TextView artist = (TextView) nowPlayingView.findViewById(R.id.artist);
        title.setText(MusicUtils.sService.getTrackName());
        String artistName = MusicUtils.sService.getArtistName();
        if (MediaStore.UNKNOWN_STRING.equals(artistName)) {
            artistName = a.getString(R.string.unknown_artist_name);
        }
        artist.setText(artistName);
        //mNowPlayingView.setOnFocusChangeListener(mFocuser);
        //mNowPlayingView.setOnClickListener(this);
        nowPlayingView.setVisibility(View.VISIBLE);
        nowPlayingView.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // Context c = v.getContext();
                // c.startActivity(new Intent(c, MediaPlaybackActivity.class));
            }
        });
        return;
    }
    nowPlayingView.setVisibility(View.GONE);
}

From source file:com.expertiseandroid.lib.sociallib.connectors.BuzzConnector.java

public void authorize(Activity ctx) throws OAuthMessageSignerException, OAuthNotAuthorizedException,
        OAuthExpectationFailedException, OAuthCommunicationException {
    String verifier = ctx.getIntent().getData().getQueryParameter(oauth.signpost.OAuth.OAUTH_VERIFIER);
    httpOauthprovider.retrieveAccessToken(httpOauthConsumer, verifier);
    accessToken = new Token(httpOauthConsumer.getToken(), httpOauthConsumer.getTokenSecret());
    authentified = true;/*from w  ww . j  av a 2  s  . co  m*/
}

From source file:whipkey.stemesteem.components.EndingListFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {/*w  w w  . j  a  v a  2 s .  co m*/
        dialogClickListener = (DialogItemClickListener) activity;
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) < Configuration.SCREENLAYOUT_SIZE_LARGE) {
            i = activity.getIntent();
            b = i.getExtras();
        } // the above is skipped if we are on a large/xlarge device,
          // because we have no intent (one activity, not two).

    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + "needs to implement DialogClickListener");
    }
}

From source file:org.totschnig.myexpenses.activity.ProtectedFragmentActivity.java

/**
 * Workaround for broken {@link NavUtils#shouldUpRecreateTask(android.app.Activity, Intent)}
 *
 * @param from//from ww  w.j  a va2s .  co m
 * @return
 * @see <a href="http://stackoverflow.com/a/20643984/1199911">http://stackoverflow.com/a/20643984/1199911</a>
 */
protected final boolean shouldUpRecreateTask(Activity from) {
    return from.getIntent().getBooleanExtra(AbstractWidget.EXTRA_START_FROM_WIDGET, false);
}

From source file:ca.rmen.android.palidamuerte.app.poem.list.PoemListFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Activity activity = getActivity();
    new AsyncTask<Void, Void, String>() {

        @Override/*from  w  ww.ja v  a  2  s  . c  o  m*/
        protected String doInBackground(Void... params) {
            return Poems.getActivityTitle(activity, activity.getIntent());
        }

        @Override
        protected void onPostExecute(String categoryName) {
            activity.getActionBar().setTitle(categoryName);
        }

    }.execute();

}

From source file:com.arellomobile.android.push.PushManager.java

boolean onHandlePush(Activity activity) {
    Bundle pushBundle = activity.getIntent().getBundleExtra("pushBundle");
    if (null == pushBundle || null == mContext) {
        return false;
    }//from w w  w.j  a  v a 2  s  .  co  m

    mLastBundle = pushBundle;

    JSONObject dataObject = new JSONObject();
    try {
        if (pushBundle.containsKey("title")) {
            dataObject.put("title", pushBundle.get("title"));
        }
        if (pushBundle.containsKey("u")) {
            dataObject.put("userdata", pushBundle.get("u"));
        }
        if (pushBundle.containsKey("local")) {
            dataObject.put("local", pushBundle.get("local"));
        }
    } catch (JSONException e) {
        // pass
    }

    PushEventsTransmitter.onMessageReceive(mContext, dataObject.toString(), pushBundle);

    // push message handling
    String url = (String) pushBundle.get("h");

    if (url != null) {
        url = String.format(HTML_URL_FORMAT, url);

        // show browser
        Intent intent = new Intent(activity, PushWebview.class);
        intent.putExtra("url", url);
        activity.startActivity(intent);
    }

    // send pushwoosh callback
    sendPushStat(mContext, pushBundle.getString("p"));

    return true;
}

From source file:edu.stanford.junction.android.AndroidJunctionMaker.java

public URI getInvitationForActivity(Activity activity) {
    try {/*from  w  ww .  ja  v a2  s .c o m*/
        return new URI(activity.getIntent().getExtras().getString("invitationURI"));
    } catch (Exception e) {
        Log.e("junction", "could not get invitation URI", e);
        return null;
    }
}