package com.android;
import com.android.FootBallaActivity;import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.SyncStateContract.Constants;
import android.widget.Toast;public class goalThread extends Handler {
Context context;
FootBallaActivity football;

public void getContent(Context context){
this.context=context;
}
public void handleMessage(Message msg) {
football=new FootBallaActivity();
// TODO Auto-generated method stub
switch (msg.what) {
    case 1:
            // We are now back in the UI thread
     AlertDialog.Builder normalDia=new AlertDialog.Builder(context);
        normalDia.setTitle("普通的对话框");
        normalDia.setMessage("你输了!再来一局?");
        
        normalDia.setPositiveButton("确定",new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
             football.start();
         //此处调用FootBallaActivity的Start(),
             //other.startSucc();
            }
        } );
        normalDia.setNegativeButton("退出", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
             //   showClickMessage("取消");
             System.exit(0);
            }
        });
        normalDia.create().show();
        break;
    case 0:
     AlertDialog.Builder normalDia2=new AlertDialog.Builder(context);
        normalDia2.setTitle("小游戏");
        normalDia2.setMessage("你赢了!是否重来一局?");
        normalDia2.setPositiveButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
              //  showClickMessage("确定");
             football.start();
             //other.startSucc();
            
            
            }
        });
        normalDia2.setNegativeButton("退出", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
             //   showClickMessage("取消");
             System.exit(0);
            }
        });
        normalDia2.create().show();
        break;
    }}}
/*******************/
football.start();在FootBallaActivity中方法
      public  void start(){
     Intent intent = getIntent();
        finish();
        startActivity(intent);    }