解决方案 »

  1.   

    这是Factivity,也急速hi第一个页面的Java代码,另外说下这些代码都没有报错啊package com.exaple.tiaozhuan;import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;public class FActivity extends Activity{
    private Button bt1;
    private Context mContext;
    protected void onCreat (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.factivity);

    bt1=(Button)findViewById(R.id.button1_first);
    /*
     * 通过点击bt1实现页面之间的跳转
     *1.startActivity方式实现
     *1》初始化intent
     */
    bt1.setOnClickListener(new OnClickListener( ){  //注册点击事件
    @SuppressWarnings("unused")
    public void onClickListener(View v) {
    Intent intent=new Intent(mContext,SActivity.class);
    /*
     * 第一个参数:上下文对象this
     * 第二个对象:目标文件
     */
    startActivity(intent);
    } @Override
    public void onClick(View arg0) {
    // TODO Auto-generated method stub

    }
    });
    }
    }
      

  2.   

    这是第二个界面也就是要跳到的那个。。没哟什么内容的package com.exaple.tiaozhuan;import android.app.Activity;
    import android.os.Bundle;public class SActivity extends Activity{
    protected void onCreat(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sactivity);
    }
    }
      

  3.   

    这是manifest的代码
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.exaple.tiaozhuan"
        android:versionCode="1"
        android:versionName="1.0" >    <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="18" />    <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            
                <activity
                android:name="com.exaple.tiaozhuan.FActivity"
                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="com.exaple.tiaozhuan.SActivity">
            </activity>
            
            
        </application></manifest>
      

  4.   

    代码错了吧,首先你的代码中 Intent intent=new Intent(mContext,SActivity.class);
    /*
     * 第一个参数:上下文对象this
     * 第二个对象:目标文件
     */
    startActivity(intent);在 onClick 的外层,你使用的 IDE对这种情况没有报错吗?你直接是在一个内部类的内层直接调用方法的,第二你发的时候最好发一下你的布局文件
      

  5.   

    放到里面还会有错,刚才想放xml的,系统说不能连续发三个回帖我放在楼下啦
      

  6.   

    第二个也就是要跳转到的那个页面的布局
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >    <Button
            android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Button" />    <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/ermian" /></LinearLayout>
      

  7.   

    第一个页面的布局
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >    <Button
            android:id="@+id/button1_first"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/diyi" />    <Button
            android:id="@+id/button2_second"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/dier" />    <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/wenben" /></LinearLayout>
      

  8.   

    你先把Intent intent=new Intent(mContext,SActivity.class);
    /*
     * 第一个参数:上下文对象this
     * 第二个对象:目标文件
     */
    startActivity(intent);放到 onClick(v)里,然后把 onClickListener 方法删掉吧.另外想问下你,你的具体情况是什么,是第一个界面能显示,点击按钮后跳转到第二个界面不显示,还是第一个界面也没法显示
      

  9.   

    ....看到了,你的 onCreate的名字竟然是 onCreat 少了一个 e,系统没有识别出正确的入口
      

  10.   

    可以了么,我看了一下你的第一个activity,Intent intent=new Intent(mContext,SActivity.class);mcontext好像没有初始化
      

  11.   

    bt1.setOnClickListener(new VIew.OnClickListener( ){  //注册点击事件public void onClick(View v) {
    Intent intent=new Intent(mContext,SActivity.class);
    /*
     * 第一个参数:上下文对象this
     * 第二个对象:目标文件
     */
    startActivity(intent);
    }