inviteBu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(ChoiceList.size()>0)
{
LayoutInflater factory = LayoutInflater.from(MobileConnectActivity.this);
final View textEntryView = factory.inflate(R.layout.invite_dialog, null);
final EditText et =(EditText) textEntryView.findViewById(R.id.usercontent_edit);
dia= new AlertDialog.Builder(MobileConnectActivity.this)
.setTitle(getString(R.string.invite_input_content))
.setView(textEntryView)
.setPositiveButton(getString(R.string.invite_send), new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, int whichButton) {
dialog.dismiss();
if(et.getText().toString()==null && et.getText().equals("") )
{
Toast.makeText(getApplicationContext(), getString(R.string.invite_content_check), Toast.LENGTH_SHORT).show();
}
else{
new AsyncTask<Void, Void, String>() {
CustomDialog mProgressBar = new CustomDialog(MobileConnectActivity.this, R.style.dialog);
protected void onPreExecute() {
mProgressBar.show();
};
protected void onCancelled() {
mProgressBar.hide();
};
@Override
protected String doInBackground(Void... params) {
ChoiceList=removeDuplicateList(ChoiceList);
for(int i=0;i<ChoiceList.size();i++)
{
Log.i("aaa",""+ChoiceList.get(i));
sendSMS(ChoiceList.get(i), et.getText().toString());
}
return "OK";
}
protected void onPostExecute(String response) {
mProgressBar.hide();
if (response != null ) {
Toast.makeText(getApplicationContext(), getString(R.string.invite_succeed), Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.setClass(MobileConnectActivity.this, inviteMainActivity.class);
startActivity(intent);
MobileConnectActivity.this.finish();
} else {
//mHelper.showResponseErrorMessage(response);
Intent intent = new Intent();
intent.setClass(MobileConnectActivity.this, inviteMainActivity.class);
startActivity(intent);
finish();
}
};
}.execute();
}
}
})
.setNegativeButton(getString(R.string.invite_cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked cancel so do some stuff */
}
}).show();
}
else
{
Toast.makeText(getApplicationContext(), getString(R.string.invite_choice_check), Toast.LENGTH_SHORT).show();
}
}
});
它给了我:
07-21 03:36:24.519: E/WindowManager(23240): Activity com.portaura.myaura.invite.MobileConnectActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405c32d0 that was originally added here
07-21 03:36:24.519: E/WindowManager(23240): android.view.WindowLeaked: Activity com.portaura.myaura.invite.MobileConnectActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405c32d0 that was originally added here
07-21 03:36:24.519: E/WindowManager(23240): at android.view.ViewRoot.<init>(ViewRoot.java:266)
07-21 03:36:24.519: E/WindowManager(23240): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:174)
07-21 03:36:24.519: E/WindowManager(23240): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:117)
07-21 03:36:24.519: E/WindowManager(23240): at android.view.Window$LocalWindowManager.addView(Window.java:424)
07-21 03:36:24.519: E/WindowManager(23240): at android.app.Dialog.show(Dialog.java:241)
07-21 03:36:24.519: E/WindowManager(23240): at com.portaura.myaura.invite.MobileConnectActivity$3$1$1.onPreExecute(MobileConnectActivity.java:161)
07-21 03:36:24.519: E/WindowManager(23240): at android.os.AsyncTask.execute(AsyncTask.java:391)
07-21 03:36:24.519: E/WindowManager(23240): at com.portaura.myaura.invite.MobileConnectActivity$3$1.onClick(MobileConnectActivity.java:201)
07-21 03:36:24.519: E/WindowManager(23240): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:165)
07-21 03:36:24.519: E/WindowManager(23240): at android.os.Handler.dispatchMessage(Handler.java:99)
07-21 03:36:24.519: E/WindowManager(23240): at android.os.Looper.loop(Looper.java:130)
07-21 03:36:24.519: E/WindowManager(23240): at java.lang.reflect.Method.invokeNative(Native Method)
07-21 03:36:24.519: E/WindowManager(23240): at java.lang.reflect.Method.invoke(Method.java:507)