This dialog box asks if you want to install any other application ... therefore, when the onclicked no button does not return, it should return to the previous screen
downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { finish(); } });
this gives an error:
The finish () method is undefined for the type new DialogInterface.OnClickListener () {}
How can I achieve what I need?
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; @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);
source share