Example usage for android.content Intent removeExtra

List of usage examples for android.content Intent removeExtra

Introduction

In this page you can find the example usage for android.content Intent removeExtra.

Prototype

public void removeExtra(String name) 

Source Link

Document

Remove extended data from the intent.

Usage

From source file:Main.java

/**
 * Remove all extras from intent//from   w  w  w . ja v  a 2s.c o  m
 */
public static void clearExtras(Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras == null) {
        return;
    }
    for (String key : extras.keySet()) {
        intent.removeExtra(key);
    }
}

From source file:Main.java

/**
 * Converts a fragment arguments bundle into an intent.
 *//*from  ww  w  . ja va 2s. co m*/
public static Intent fragmentArgumentsToIntent(Bundle arguments) {
    Intent intent = new Intent();
    if (arguments == null) {
        return intent;
    }

    final Uri data = arguments.getParcelable("_uri");
    if (data != null) {
        intent.setData(data);
    }

    intent.putExtras(arguments);
    intent.removeExtra("_uri");
    return intent;
}

From source file:Main.java

/**
 * Convert a fragment arguments bundle into an intent.
 *//*from  www  . j a  va2s .  co m*/
public static Intent fragmentArgumentsToIntent(Bundle arguments) {
    Intent intent = new Intent();
    if (arguments == null) {
        return intent;
    }

    final Uri data = arguments.getParcelable(URI_KEY);
    if (data != null) {
        intent.setData(data);
    }

    intent.putExtras(arguments);
    intent.removeExtra(URI_KEY);
    return intent;
}

From source file:org.chromium.chrome.browser.util.IntentUtils.java

/**
 * Just like {@link Intent#removeExtra(String)} but doesn't throw exceptions.
 *//* ww  w  .  ja  v a2  s . c om*/
public static void safeRemoveExtra(Intent intent, String name) {
    try {
        intent.removeExtra(name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "removeExtra failed on intent " + intent);
    }
}

From source file:at.ac.uniklu.mobile.sportal.util.Utils.java

/**
 * Returns the value of the EXTRA_REFETCH_DATA flag of an intent, and removes it
 * if it is set. This flag tells an Activity if it should load the data freshly from the
 * server by invalidating the cache./*from   w w  w  .j  a  v  a 2 s  .  c  om*/
 */
public static boolean shouldRefetchData(Intent i) {
    boolean refetch = i.getBooleanExtra(Studentportal.EXTRA_REFETCH_DATA, false);
    if (refetch) {
        i.removeExtra(Studentportal.EXTRA_REFETCH_DATA);
    }
    return refetch;
}

From source file:net.granoeste.scaffold.app.ScaffoldActivity.java

/**
 * Converts a fragment arguments bundle into an intent.
 *///from  w  w  w  .j  a  va  2s.  com
public static Intent fragmentArgumentsToIntent(final Bundle arguments) {
    final Intent intent = new Intent();
    if (arguments == null) {
        return intent;
    }

    final Uri data = arguments.getParcelable(ScaffoldConstants.ARG_URI);
    if (data != null) {
        intent.setData(data);
    }

    final String action = arguments.getString(ScaffoldConstants.ARG_ACTION);
    if (action != null) {
        intent.setAction(action);
    }

    intent.putExtras(arguments);
    intent.removeExtra(ScaffoldConstants.ARG_URI);
    return intent;
}

From source file:it.geosolutions.android.map.fragment.featureinfo.FeatureInfoLayerListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);
    //init progress bar and loading text
    startLoadingGUI();//w  w w . j a  v  a 2 s.c o  m
    //set the click listener for the items
    getListView().setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(view.getContext(), GetFeatureInfoAttributeActivity.class);
            i.putExtras(getActivity().getIntent().getExtras());
            i.removeExtra(Constants.ParamKeys.LAYERS);
            // add a list with only one layer
            ArrayList<Layer<?>> subList = new ArrayList<Layer<?>>();
            FeatureInfoQueryResult item = (FeatureInfoQueryResult) parent.getAdapter().getItem(position);
            subList.add(item.getLayer());
            i.putExtra(Constants.ParamKeys.LAYERS, subList);
            i.putExtra("start", 0);
            i.putExtra("limit", 1);
            //don't allow picking the position 
            String action = getActivity().getIntent().getAction();
            i.setAction(action);
            getActivity().startActivityForResult(i, GetFeatureInfoAttributeActivity.GET_ITEM);
        }
    });
}

From source file:ch.ethz.twimight.activities.ShowTweetListActivity.java

/**
 * On resume/*from w w  w  .ja va2  s . c o  m*/
 */
@Override
public void onResume() {

    super.onResume();
    running = true;

    Intent intent = getIntent();

    if (intent.hasExtra(FILTER_REQUEST)) {
        viewPager.setCurrentItem(intent.getIntExtra(FILTER_REQUEST, TweetListFragment.TIMELINE_KEY));
        intent.removeExtra(FILTER_REQUEST);

    }

}

From source file:it.geosolutions.android.map.fragment.FeaturePolygonLayerListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);
    //init progress bar and loading text
    startLoadingGUI();/*from   w  w w .  j  a  v a2s  .  c  o  m*/
    //set the click listener for the items
    getListView().setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(view.getContext(), GetFeatureInfoAttributeActivity.class);
            i.putExtras(getActivity().getIntent().getExtras());
            i.removeExtra("layers");
            // add a list with only one layer
            ArrayList<String> subList = new ArrayList<String>();
            FeaturePolygonQueryResult item = (FeaturePolygonQueryResult) parent.getAdapter().getItem(position);
            subList.add(item.getLayerName());
            i.putExtra("layers", subList);
            i.putExtra("start", 0);
            i.putExtra("limit", 1);
            //don't allow picking the position 
            String action = getActivity().getIntent().getAction();
            i.setAction(action);
            getActivity().startActivityForResult(i, GetFeatureInfoAttributeActivity.GET_ITEM);
        }
    });
}

From source file:it.geosolutions.android.map.fragment.FeatureCircleLayerListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);
    //init progress bar and loading text
    startLoadingGUI();//from  www . jav a 2  s.com
    //set the click listener for the items
    getListView().setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(view.getContext(), GetFeatureInfoAttributeActivity.class);
            i.putExtras(getActivity().getIntent().getExtras());
            i.removeExtra("layers");
            // add a list with only one layer
            ArrayList<String> subList = new ArrayList<String>();
            FeatureCircleQueryResult item = (FeatureCircleQueryResult) parent.getAdapter().getItem(position);
            subList.add(item.getLayerName());
            i.putExtra("layers", subList);
            i.putExtra("start", 0);
            i.putExtra("limit", 1);
            //don't allow picking the position 
            String action = getActivity().getIntent().getAction();
            i.setAction(action);
            getActivity().startActivityForResult(i, GetFeatureInfoAttributeActivity.GET_ITEM);
        }
    });
}