public void onClick(View v) { // TODO Auto-generated method stub clickCount=clickCount+=1; try { if(clickCount<=5){ Intent intent = new Intent(ACTION_SCAN); intent.putExtra("SCAN_MODE", "PRODUCT_MODE"); startActivityForResult(intent, 0); } else { AlertDialog.Builder alertdialogBuilder=new AlertDialog.Builder(getApplicationContext()); alertdialogBuilder.setMessage(R.string.decision); alertdialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Intent positveActivity = new Intent(getApplicationContext(),MainActivity.class); startActivity(positveActivity); } }); AlertDialog alertDialog = alertdialogBuilder.create(); alertDialog.show(); //Toast.makeText(getApplicationContext(), "Reached Maximum scan Primay" , Toast.LENGTH_LONG).show(); //Intent i1=new Intent(getApplicationContext(),MainActivity.class); //startActivity(i1); } //start the scanning activity from the com.google.zxing.client.android.SCAN intent } catch (ActivityNotFoundException anfe) { //on catch, show the download dialog showDialog(Secondary.this, "No Scanner Found", "Download a scanner code activity?", "Yes", "No").show(); } } }); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)