-5
package islam.work;
import java.net.URI;

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
                {


                    startActivity(new Intent("islam.work.program"));//error here

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

2 回答 2

2

finally将您的块更改为

finally
{
    startActivity(new Intent(Tasbeeeee7_IslamicActivity.this,Program.class)); // where Program is second activity
}

并将Program.java清单文件添加为

<activity
     android:label="Program"
     android:name="islam.work.Program" >
</activity>

希望这可以帮助。

于 2013-10-14T04:08:19.540 回答
1

确保您已在清单中声明您的活动。大多数时候,人们会忘记并花无数时间查看代码。

也尝试做这样的事情。

Intent intent = new Intent(this, DisplayMessageActivity.class);
于 2013-10-14T04:12:06.850 回答