我是一个活动,在你的情况下我 = 这个;关键是使用 runOnUiThread(new Runnable(){public void run(){}}
public void rateMe(String s){
me.runOnUiThread(new Runnable() {
public void run() {
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle("Rate Me");
dialog.setMessage("If you enjoy this game, please take a moment to rate it. Thanks for your support!");
//tv.setWidth(240);
dialog.setPositiveButton("Rate Now",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0,
int arg1) {
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.home.test")));
}
});
dialog.setNegativeButton("No, thanks",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0,
int arg1) {
}
});
dialog.show();
}
});
}