-1
package islam.work;


import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class Tasbeeeee7_IslamicActivity extends Activity {

    MediaPlayer begin;
    Intent inti;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        begin = MediaPlayer.create(Tasbeeeee7_IslamicActivity.this, R.drawable.media);
        begin.start();
        Thread timer = new Thread(){
            public void run(){
                try {
                    sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                finally
                {



                    inti = new Intent(this,  program.class); //error here



                    startActivity(inti);

                }
            }
        };
        timer.start();
    }
}
4

1 回答 1

0

改变

inti = new Intent(this,  program.class);

inti = new Intent(Tasbeeeee7_IslamicActivity .this,  program.class);

由于您正在构建Intenta 的内部Threadthis因此指的是Thread而不是您的Activity Context.

于 2013-10-14T03:31:23.953 回答