As a result of the scanner to add/delete from the MySQL database?

0 like 0 dislike
13 views
I have an app which has been scanner "zxing". I need the result of the scanner to add or remove from the database by pressing the button. Tell me how it can be implemented?

Code of the scanner:

public class ScannerActivity extends AppCompatActivity { static final String ACTION_SCAN = "com.google.zxing.client.android.SCAN"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R. layout.activity_scanner); } /*Start the qr code scanner:*/ public void scanQR(View v) { try { /*Start the transition to com.google.zxing.client.android.SCAN through intent:*/ Intent intent = new Intent(ACTION_SCAN); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, 0); } catch (ActivityNotFoundException anfe) { /*It is possible to download from Play Market:*/ showDialog(ScannerActivity.this "Scanner not found", "to Install the scanner from Play Market?", "Yes", "No").show(); } } /*alert dialog to access the app download of scanner:*/ private static AlertDialog showDialog(final Activity act, CharSequence title, CharSequence message,CharSequence buttonYes, CharSequence buttonNo) { AlertDialog.Builder downloadDialog = new AlertDialog.Builder(act); downloadDialog.setTitle(title); downloadDialog.setMessage(message); downloadDialog.setPositiveButton(buttonYes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { /*Link the search request to download the app:*/ Uri uri = Uri.parse("market://search?q=pname:" + "com.google.zxing.client.android"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); try { act.startActivity(intent); } catch (ActivityNotFoundException anfe) { } } }); downloadDialog.setNegativeButton(buttonNo, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { } }); return downloadDialog.show(); } /*Process the result obtained from the application of the scanner:*/ public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == RESULT_OK) { /*Get the data after operation of the scanner and display them in Toast the message:*/ String contents = intent.getStringExtra("SCAN_RESULT"); String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); Toast toast = Toast.makeText(this, "Content:" + contents + "Format:" + format, Toast.LENGTH_LONG); toast.show(); } } } }


After scanning need to open Activity in which we will have by clicking on the add button the result in MySQL database, or remove it from the base.
5aea8ddcb0d3a031087626.png
by | 13 views

1 Answer

0 like 0 dislike
To create a table to store the results.
When scanning to send the prompt to save.
Clicking on the delete button to send the delete request.

\rwww.sql.ru/docs/mysql/rus_ref
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
110,608 questions
257,186 answers
0 comments
33,911 users