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.MountainPassItemForecastFragment.java

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

    Bundle args = activity.getIntent().getExtras();
    forecastsArray = args.getString("Forecasts");

    JSONArray forecasts;/*from  w w  w .  j ava 2 s .  c om*/
    ForecastItem f = null;
    forecastItems = new ArrayList<ForecastItem>();

    try {
        forecasts = new JSONArray(forecastsArray);
        int numForecasts = forecasts.length();
        for (int i = 0; i < numForecasts; i++) {
            JSONObject forecast = forecasts.getJSONObject(i);
            f = new ForecastItem();
            f.setDay(forecast.getString("Day"));
            f.setForecastText(forecast.getString("ForecastText"));
            f.setWeatherIcon(forecast.getInt("weather_icon"));
            forecastItems.add(f);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:ca.rmen.android.networkmonitor.app.prefs.FilterColumnListFragment.java

@Override
public void onAttach(Activity activity) {
    Log.v(TAG, "onAttach");
    super.onAttach(activity);
    mColumnName = activity.getIntent().getExtras().getString(FilterColumnActivity.EXTRA_COLUMN_NAME);
    getLoaderManager().initLoader(URL_LOADER, null, mLoaderCallbacks);

}

From source file:com.androidquery.simplefeed.PQuery.java

public void result(Activity act, int resultCode, Intent data) {

    Intent input = act.getIntent();

    if (input != null) {
        data.putExtra(FW_CB, input.getStringExtra(FW_CB));
        data.putExtra(FW_ID, input.getIntExtra(FW_ID, -1));
    }/*  ww w.  j av a 2 s .  c  o m*/

    act.setResult(resultCode, data);

}

From source file:org.openlmis.core.view.fragment.StockMovementHistoryFragment.java

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

    stockCardID = activity.getIntent().getLongExtra(Constants.PARAM_STOCK_CARD_ID, 0);
    if (activity instanceof BaseView) {
        baseView = (BaseView) activity;/*from  ww w . ja v a 2  s  .co m*/
    } else {
        throw new ClassCastException("Host Activity should implements LoadingView method");
    }
}

From source file:at.bitfire.davdroid.ui.setup.LoginCredentialsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.login_credentials_fragment, container, false);

    radioUseEmail = (RadioButton) v.findViewById(R.id.login_type_email);
    emailDetails = (LinearLayout) v.findViewById(R.id.login_type_email_details);
    editEmailAddress = (EditText) v.findViewById(R.id.email_address);
    editEmailPassword = (EditPassword) v.findViewById(R.id.email_password);

    radioUseURL = (RadioButton) v.findViewById(R.id.login_type_url);
    urlDetails = (LinearLayout) v.findViewById(R.id.login_type_url_details);
    editBaseURL = (EditText) v.findViewById(R.id.base_url);
    editUserName = (EditText) v.findViewById(R.id.user_name);
    editUrlPassword = (EditPassword) v.findViewById(R.id.url_password);

    radioUseEmail.setOnCheckedChangeListener(this);
    radioUseURL.setOnCheckedChangeListener(this);

    if (savedInstanceState == null) {
        // first call

        Activity activity = getActivity();
        Intent intent = (activity != null) ? activity.getIntent() : null;
        if (intent != null) {
            // we've got initial login data
            String url = intent.getStringExtra(LoginActivity.EXTRA_URL),
                    username = intent.getStringExtra(LoginActivity.EXTRA_USERNAME),
                    password = intent.getStringExtra(LoginActivity.EXTRA_PASSWORD);

            if (url != null) {
                radioUseURL.setChecked(true);
                editBaseURL.setText(url);
                editUserName.setText(username);
                editUrlPassword.setText(password);
            } else {
                radioUseEmail.setChecked(true);
                editEmailAddress.setText(username);
                editEmailPassword.setText(password);
            }// w  ww. j av  a 2s  . co m

        } else
            radioUseEmail.setChecked(true);
    }

    final Button login = (Button) v.findViewById(R.id.login);
    login.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            LoginCredentials credentials = validateLoginData();
            if (credentials != null)
                DetectConfigurationFragment.newInstance(credentials).show(getFragmentManager(), null);
        }
    });

    return v;
}

From source file:com.github.pockethub.android.ui.commit.CommitListFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);

    Activity activity = (Activity) context;
    repository = activity.getIntent().getParcelableExtra(EXTRA_REPOSITORY);
}

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

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

    Bundle args = activity.getIntent().getExtras();
    camerasArray = args.getString("Cameras");
}

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

public void authorize(Activity ctx) {
    Map<String, String> params = Utils.decodeUri(ctx.getIntent().getData().toString());
    String verifier = params.get(OAUTH_VERIFIER);
    accessToken = scribe.getAccessToken(requestToken, verifier);
    authentified = true;/*from w  w w .  j a v a  2 s .co m*/
}

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

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

    Bundle args = activity.getIntent().getExtras();
    mAlerts = args.getString("alert");
}

From source file:com.facebook.login.LoginFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        loginClient = savedInstanceState.getParcelable(SAVED_LOGIN_CLIENT);
        loginClient.setFragment(this);
    } else {//from www. java2  s  . co  m
        loginClient = new LoginClient(this);
    }

    loginClient.setOnCompletedListener(new LoginClient.OnCompletedListener() {
        @Override
        public void onCompleted(LoginClient.Result outcome) {
            onLoginClientCompleted(outcome);
        }
    });

    Activity activity = getActivity();
    if (activity == null) {
        return;
    }

    initializeCallingPackage(activity);
    if (activity.getIntent() != null) {
        request = (LoginClient.Request) activity.getIntent().getParcelableExtra(EXTRA_REQUEST);
    }
}