正在写一个activity跳转的例子.代码如下.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button_login=(Button)findViewById(R.id.btn1);
NameEditText=(EditText)findViewById(R.id.etext1);
button_login.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{
NameEditText.setText("OK");
Intent openWelcom=new Intent();
openWelcom.setClass(helloandriod.this,twoapp.class );
startActivity(openWelcom);
}
}
);
xml如下:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".helloandriod"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".twoapp" android:label="@string/twoapp_name"> </activity>
</application>
现在报错
twoapp cannot be resolved to a type
请高人帮看看吧.搞了两天了查不出问题.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button_login=(Button)findViewById(R.id.btn1);
NameEditText=(EditText)findViewById(R.id.etext1);
button_login.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{
NameEditText.setText("OK");
Intent openWelcom=new Intent();
openWelcom.setClass(helloandriod.this,twoapp.class );
startActivity(openWelcom);
}
}
);
xml如下:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".helloandriod"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".twoapp" android:label="@string/twoapp_name"> </activity>
</application>
现在报错
twoapp cannot be resolved to a type
请高人帮看看吧.搞了两天了查不出问题.
解决方案 »
- 如何启动事先地未配置的指定的任意 Android/iOS App
- 地图编辑器mappy生成的2维数组怎么用?
- 三星盖世s5660 求助!
- 请问View控件的id是根据什么算法计算出的?
- 有人用android模拟浏览器的时候,解析网页并提取网页数据么?
- 广播接受时 无法实例化
- git pull 和 git push
- listview里的item放webview
- 请问下像内置mail应用那样的ListView带CheckBox的效果怎么做?
- dlopen failed: library "/system/lib64/libc++_shared.so" needed or dlopened by "/
- 签名的新发现~~
- 请问程序生成的TextView如何指定style ?
<action android:name="com.jsr.demo.Image" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
你要跳转到的那个Activity需要注册啊
第二:这两个类在同一个包下。