此对话框询问您是否要安装其他应用程序...因此,当单击无按钮时,它必须返回上一个屏幕
downloadDialog.setNegativeButton(stringButtonNo,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
});
这给出了错误:
未为类型 new DialogInterface.OnClickListener(){} 定义方法 finish()
我怎样才能达到我想要的???
package com.Android.barcode;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
public class BarcodeActivity extends Activity {
public static String upc;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
IntentIntegrator.initiateScan(this);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case IntentIntegrator.REQUEST_CODE: {
if (resultCode != RESULT_CANCELED) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(
requestCode, resultCode, data);
if (scanResult != null) {
upc = scanResult.getContents();
Intent intent = new Intent(BarcodeActivity.this, BarcodeResult.class);
startActivity(intent);
// put whatever you want to do with the code here
/* TextView tv = new TextView(this);
tv.setText(upc);
setContentView(tv);*/
}
}
break;
}
}
}
}