标签:oncreate create main span byte app bytearray pat ble
质量压缩
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView imageView = findViewById(R.id.image); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon12); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.JPEG, 100,bos);//会出现红线但可以运行 byte[] bytes = bos.toByteArray(); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); imageView.setImageBitmap(bitmap); } }
标签:oncreate create main span byte app bytearray pat ble
原文地址:https://www.cnblogs.com/Ocean123123/p/10966472.html