Intent setComponent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Intent setComponent method.

This code example shows how to use the following methods: toString, setComponent
	public void onReceive(Context context, Intent intent) {
		// just make sure we are getting the right intent (better safe than sorry) 
		//String itclass = intent.get("intentclass"); 
		if ( "android.intent.action.BOOT_COMPLETED".equals(intent.getAction()) ||
				intent.getBooleanExtra("ThisIntentIsTPStartUpClass",false) ) {
			ComponentName comp = new ComponentName(context.getPackageName(), PingService.class.getName());
			ComponentName service = context.startService(new Intent().setComponent(comp));
			if (null == service){
				// something really wrong here 
				Log.e(TAG, "Could not start service " + comp.toString());
			} 
		} else { 
			Log.e(TAG, "Received unexpected intent " + intent.getAction());   
		} 
	} 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setComponent
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setComponent
 
    return(super.onOptionsItemSelected(item));
  } 
 
  private void refreshPlugin() { 
    Intent call=new Intent(ACTION_CALL_FOR_CONTENT);
 
    call.setComponent(pluginCN);
    sendBroadcast(call);
  } 
 
  private BroadcastReceiver plugin=new BroadcastReceiver() {
    @Override 
    public void onReceive(Context ctxt, Intent i) { 
      if (ACTION_REGISTER_PLUGIN.equals(i.getAction())) { 
        pluginCN=(ComponentName)i.getParcelableExtra(EXTRA_COMPONENT); 
      } 
      else if (ACTION_DELIVER_CONTENT.equals(i.getAction())) { 
        RemoteViews rv=(RemoteViews)i.getParcelableExtra(EXTRA_CONTENT); 
        ViewGroup frame=(ViewGroup)findViewById(android.R.id.content); 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setComponent
     * Checks whether the global search provider with a given 
     * component name is installed on the system or not. This deals with 
     * cases such as the removal of an installed provider. 
     */ 
    private boolean isInstalled(ComponentName globalSearch) {
        Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH);
        intent.setComponent(globalSearch);
 
        List<ResolveInfo> activities = queryIntentActivities(intent,
                PackageManager.MATCH_DEFAULT_ONLY);
        if (activities != null && !activities.isEmpty()) {
            return true; 
        } 
 
        return false; 
    } 
 
    private static final Comparator<ResolveInfo> GLOBAL_SEARCH_RANKER =
            new Comparator<ResolveInfo>() { 
        @Override 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addCategory, setComponent
        startActivity(intent);
    } 
 
    @Override 
    public boolean onLongClick(View v) {
        Intent intent = new Intent("android.intent.action.MAIN");
        intent.setComponent(ComponentName
                .unflattenFromString("com.aokp.romcontrol/.ROMControlActivity"));
        intent.addCategory("android.intent.category.LAUNCHER");
 
        startActivity(intent);
        return super.onLongClick(v);
    } 
 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Intent setComponent Questions & Answers:

setComponent Method Overview
(Usually optional) Explicitly set the component to handle the intent.
See Code Examples for other Android Intent Methods: