你是报错还是没反应?报错的话估计是没注册activity或者包名类名写错了
没反应的话,你在onclick里头写个输出看看到底click执行没有而且一般都是这样写比较不会出错
intent.setClassName(DemoControlActivity.this.getPackageName(), act2.class.getName());
没反应的话,你在onclick里头写个输出看看到底click执行没有而且一般都是这样写比较不会出错
intent.setClassName(DemoControlActivity.this.getPackageName(), act2.class.getName());
解决方案 »
- 如何使拖动的button一直处于最上层
- POST提交数据不成功
- 请教:android能否编写可隐藏到后台运行的程序?
- android如何集成第三方apk,把apk直接烧录到板子中?
- 求大神,把iReader里下载的电子书转成TXT
- 有没有做Android海外项目的?要注意什么吗?用国外开源代码又要注意什么吗?
- 想学习安卓,看什么书比较好
- tabactivity问题
- webview.loadUrl()加载网页中的图片在手机上浏览时怎么变大了?
- Android opengl 画文字,怎么把文字后面的黑色背景去掉?
- android 4.0以上源码 gallery2 怎么取得系统和sd卡的图片资源及如何保存的
- android视频播放
最好的方式是 new Component(TartPackage, TargetClassName);
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch(item.getItemId()){
case Menu.FIRST + 1:
ComponentName componentname = new ComponentName(WolifeActivity.this, "com.sxit.login.LoginActivity");
Intent intent = new Intent();
intent.setComponent(componentname);
startActivity(intent);
break;
case Menu.FIRST + 2:
break;
case Menu.FIRST + 3:
break;
}
return super.onOptionsItemSelected(item);
}没反应。WolifeActivity 在com.sxit.wolife包下,LoginActivity在com.sxit.Login包下。
Intent i = new Intent();
i.setAction(action);
StartActivity(i);
2.如果没有定义。
Intent i = new Intent();
i.setComponentName(new ComponentName(activity's packagename, activity's classname));
StartActivity(i);
<TextView
android:id="@+id/textViewForgetPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forgetpassword"
android:clickable="true"
android:focusable="true" /> <TextView
android:id="@+id/textViewRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/speedregister"
android:clickable="true"
android:focusable="true" />
我加了啊?还是不行,点击它没反应。
试了,还是运行点击跳转钮,跳转Activity出错。