Component使用

  1. <p> 在Intent中可以直接使用Intent.setClass()</p><p>也可以使用组件Component</p><p> </p><p>简单的使用方式如下</p>

Java代码  

  1. package com.huawei;
  2. import android.app.Activity;
  3. import android.content.ComponentName;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.view.View.OnClickListener;
  8. import android.widget.Button;
  9. public class Test extends Activity {
  10. /** Called when the activity is first created. */
  11. @Override
  12. public void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. setContentView(R.layout.main);
  15. Button btn = (Button) findViewById(R.id.btn);
  16. btn.setOnClickListener(new OnClickListener() {
  17. @Override
  18. public void onClick(View v) {
  19. //组件名称,第一个参数是包名,也是主配置文件Manifest里设置好的包名
  20. 第二个是类名,要带上包名
  21. ComponentName com = new ComponentName("com.huawei", "com.huawei.Test1");
  22. Intent  intent = new Intent();
  23. //设置部件
  24. intent.setComponent(com);
  25. Test.this.startActivity(intent);
  26. }
  27. });
  28. }
  29. }
时间: 2024-07-31 05:26:58

Component使用的相关文章

【推介】TMS的控件之“TMS Unicode Component Pack”和“TMS Advanced Toolbars &amp; Menus”

TMS Unicode Component Pack是一款支持多语言的界面控件包,提供超过60种控件来为你的Delphi和C++Builder应用程序添加Unicode支持. 介绍: TMS Unicode Component Pack控制组件能让你在不终止Delphi.C++Builder或Windows 95/98/ME的情况下利用Windows NT/2000/XP/2003/Vista的Unicode功能开发应用程序.  注意:这些控制组件不会将Unicode功能添加到Windows 9

Applying GI PSU &quot;opatch auto&quot; fails with &quot;The opatch Component check failed&quot;

Applying GI PSU using "opatch auto" fails with "The opatch Component check failed" (文档 ID 1169036.1) APPLIES TO: Oracle Database - Enterprise Edition - Version 11.2.0.3 and laterInformation in this document applies to any platform.***C

主成分分析(Principal Component Analysis,PCA

主成分分析(Principal Component Analysis,PCA)是将多个变量通过线性变换以选出较少几个重要变量的多元统计分析方法. 原理:在用统计分析方法研究多变量的课题时,变量个数太多就会增加课题的复杂性.人们自然希望变量个数较少而得到的信息较多.在很多情形,变量之间是有一定的相关关系的,当两个变量之间有一定相关关系时,可以解释为这两个变量反映此课题的信息有一定的重叠.主成分分析是对于原先提出的所有变量,将重复的变量(关系紧密的变量)删去多余,建立尽可能少的新变量,使得这些新变量

Tomcat启动报错 Failed to start component [StandardServer[8005]]解决

SEVERE: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] 之前在Eclipse上部署了Tomcat服务器,今天在MyEclipse上部署,结果Tomcat启动失败,报错.在网上搜了半天,有的说是因为端口被占用,有

Kaldi的nnet2 Component

FixedAffineComponent:类 LDA-like 的非相关转换,由标准的 weight matrix plus bias 组成(即Wx+b),通过标准的 stochastic gradient descent(非minibatch SGD?) 训练而来,使用 global learning rate AffineComponentPreconditionedOnline:为 FixedAffineComponent 的一种提炼,训练过程中不仅使用global learning ra

- Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead. 解决方案

<template> <div>{{hello}}</div> <button @click="addOne">add one</button> <button @click="minusOne">minus one</button> </template> 在*.vue组件里有这么一段. 报错信息: (Emitted value instead of an instan

[Preact] Use State and Props in the Component Render Function

Preact offers, in addition to the regular component API from React, the ability to access both props & state as function parameters to the render method. This lesson will cover an example of how to utilize this convenience along with how destructurin

Spring Boot 之注解@Component @ConfigurationProperties(prefix = &quot;sms&quot;)

从spring-boot开始,已经支持yml文件形式的配置,@ConfigurationProperties的大致作用就是通过它可以把properties或者yml配置直接转成对象 例如: 配置文件: sms.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX sms.appkey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX sms.secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX sms.signName=XXXXXXXXXXXXX

Spring注解@Component、@Repository、@Service、@Controller @Resource、@Autowired、@Qualifier 解析

URL:http://www.ulewo.com/user/10001/blog/273 我们在使用spring的时候经常会用到这些注解,那么这些注解到底有什么区别呢.我们先来看代码 同样分三层来看: Action 层: package com.ulewo.ioc; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @Co

react component lifecycle

react comments 状态: 1.Mounted:React Components 被render解析生成DOM节点并被插入浏览器DOM结构的一个过程 2.Updated:Mounted的React Components 被重新render的过程 3.Unmounted:一个Mounted的React Component对应的DOM节点被从DOM中移除的过程 每一个状态都对应封装了相应的hook函数 hook函数Mounting:componentWillMount:在Component