Click here to Skip to main content
15,908,675 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am beginner to android..I am using qr scanner in my app..it displaying result after scanning from qr scanner..but I want to split string and load to shared preferences

below is my code
Java
@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		IntentResult customerSno = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
		if (customerSno != null) {
			if (customerSno.getContents() == null) {
				Log.d("ScanFragment", "Cancelled scan");
				Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
			} else {

				Log.d("ScanFragment", "Scanned");
				Toast.makeText(this, " " + customerSno.getContents(), Toast.LENGTH_LONG).show();
				setCustomerSerialNoName(customerSno.getContents().toString());
			}
		} else {
			//result fragment
			super.onActivityResult(requestCode, resultCode, data);
		}
		// }

	}

	private void setCustomerSerialNoName(String cusSno) {
		String customerSNo = IHomeActivity._sharedPreferences.getString("customerSNo", "null");

		SharedPreferences.Editor editor = IHomeActivity._sharedPreferences.edit();
		editor.putString("customerSNo", cusSno);
		editor.putString("customerPass", passcode);
		if(customerSNo.equals(cusSno)){
		}else{
			editor.putBoolean("custSNoAuthStatus", false);
		}
		editor.commit();


What I have tried:

I am tried to split string loading to shared preferences
Posted
Updated 1-Mar-16 23:22pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900