久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android:你如何通過點擊進(jìn)入另一個活動?

Android: How do you go to another activity on click?(Android:你如何通過點擊進(jìn)入另一個活動?)
本文介紹了Android:你如何通過點擊進(jìn)入另一個活動?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試依次進(jìn)行第三個活動.從主要活動轉(zhuǎn)到第二個活動很好,但是當(dāng)我嘗試從第二個活動轉(zhuǎn)到第三個活動時,應(yīng)用程序崩潰了.

I'm trying to move onto the third activity in a sequence. Going from the main activity to the second one works fine but when I try to go to the third activity from the second I the application crashes.

這是我的第二個活動的代碼:

Here's my code for the second activity:

package com.example.helloandroid;

import android.app.Activity;
//other imports here

public class Game extends Activity implements OnClickListener {

    private static final String TAG = "Matrix";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.matrix);
        View doneButton = findViewById(R.id.done_button);
        doneButton.setOnClickListener(this);
    }

    public void onClick(View v) { 
        switch (v.getId()) { 
            case R.id.done_button:
                Intent k = new Intent(this, GameTwo.class);
                startActivity(k);
                //finish();
                break;
        }
    }
}

以及第三個活動的代碼:

And the code for the third activity:

package com.example.helloandroid;

import android.app.Activity;
//other imports here

public class GameTwo extends Activity {

   private static final String TAG = "Matrix";

   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       this.setContentView(R.layout.matrixtwo);
       View donetwoButton = findViewById(R.id.donetwo_button);
   }
}

推薦答案

switch中試試下面的代碼:

try {
    Intent k = new Intent(Game.this, GameTwo.class);
    startActivity(k);
} catch(Exception e) {
    e.printStackTrace();
}

告訴我這有用嗎.....

Tell me is this helpful.....

這篇關(guān)于Android:你如何通過點擊進(jìn)入另一個活動?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 亚洲一区久久久 | 国产一区影院 | 天天影视网天天综合色在线播放 | 国产成人精品一区二区 | 亚洲欧洲中文日韩 | 欧美在线观看网站 | 99精品视频在线观看 | 国产视频第一页 | 国产精品久久国产精品久久 | 国产午夜精品久久久 | 亚洲成人精品在线观看 | 午夜欧美a级理论片915影院 | 久草免费电影 | 一区二区日本 | 伊人春色成人 | 欧美一区二区三区视频在线播放 | www.色五月.com | av一区二区三区四区 | 国产在线精品一区二区 | 国产精品国产三级国产aⅴ中文 | 高清一区二区三区 | 国产精品欧美精品 | 亚洲午夜精品一区二区三区他趣 | 国产精品成人在线观看 | 久久综合伊人一区二区三 | 亚洲精品性视频 | 人人射人人 | 中文字幕高清av | 日韩av成人 | 我要看一级片 | 午夜影院 | 激情91| 日韩久久久久久久 | 国产在线观看一区 | 人人射人人插 | 国产综合久久 | 人和拘一级毛片c | www.伊人.com| 成人在线精品视频 | 成人在线中文字幕 | 亚洲精品国产电影 |