Back to project page GradleAndroid-App.
The source code is released under:
Apache License
If you think the Android project GradleAndroid-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.android.app.function.qrcode.activity; // www . ja va 2 s . c om import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.TypedValue; import android.widget.ImageView; import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; import com.android.app.function.R; import com.android.app.function.qrcode.decode.DecodeThread; public class ResultActivity extends Activity { private ImageView mResultImage; private TextView mResultText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.qr_activity_result); Bundle extras = getIntent().getExtras(); mResultImage = (ImageView) findViewById(R.id.result_image); mResultText = (TextView) findViewById(R.id.result_text); if (null != extras) { int width = extras.getInt("width"); int height = extras.getInt("height"); LayoutParams lps = new LayoutParams(width, height); lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics()); lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics()); lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics()); mResultImage.setLayoutParams(lps); String result = extras.getString("result"); mResultText.setText(result); Bitmap barcode = null; byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP); if (compressedBitmap != null) { barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null); // Mutable copy: barcode = barcode.copy(Bitmap.Config.RGB_565, true); } mResultImage.setImageBitmap(barcode); } } }