android-bitmap

Are Android Views backed by OpenGL?

♀尐吖头ヾ 提交于 2020-06-17 09:10:47
问题 Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...) , use OpenGL under the hood? If not, are there any advantages to using OpenGL to the average Android Developer as opposed to using the regular views for custom UI components? 回答1: Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...), use OpenGL under the hood? Basically yes, OpenGL ES is the API used by the display hardware system to draw

Are Android Views backed by OpenGL?

随声附和 提交于 2020-06-17 09:10:46
问题 Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...) , use OpenGL under the hood? If not, are there any advantages to using OpenGL to the average Android Developer as opposed to using the regular views for custom UI components? 回答1: Do native Android views (View class and everything that extends it, i.e. TextView, ImageView, etc...), use OpenGL under the hood? Basically yes, OpenGL ES is the API used by the display hardware system to draw

How to crop a bitmap as of same size of a rectangular imageview?

拟墨画扇 提交于 2020-06-09 07:10:03
问题 I have a SurfaceView on screen and i want to know its starting x,y position on screen and also its width and height so as i can crop the full screen image only to the SurfaceView size part means whatever fits in that bounds and the rest of the part to be chopped off. The code I am trying is: Bitmap bitmap = BitmapFactory.decodeByteArray(mCameraData, 0, mCameraData.length); int[] location = new int[2]; mCameraPreview.getLocationOnScreen(location); int x = location[0]; int y = location[1];

How to crop a bitmap as of same size of a rectangular imageview?

北城余情 提交于 2020-06-09 07:09:09
问题 I have a SurfaceView on screen and i want to know its starting x,y position on screen and also its width and height so as i can crop the full screen image only to the SurfaceView size part means whatever fits in that bounds and the rest of the part to be chopped off. The code I am trying is: Bitmap bitmap = BitmapFactory.decodeByteArray(mCameraData, 0, mCameraData.length); int[] location = new int[2]; mCameraPreview.getLocationOnScreen(location); int x = location[0]; int y = location[1];

Android Kotlin: fetching image from directory

扶醉桌前 提交于 2020-06-06 08:34:05
问题 I am building an app with Kotlin frontend/Python backend. My python script creates a .png file under getFilesDir() directory (/data/user/0/com.example.myproject/files/mygraph.png). I then want to use kotlin to fetch the .png file and display it on imageview. Believe I have to use Bitmap but am not familiar with it so your support is much appreciated. class Graph : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R

Android Espresso match BitmapDrawables with different tint

耗尽温柔 提交于 2020-05-14 18:36:06
问题 Is there some way to compare two Bitmaps which are wrapped by the BitmapDrawable . The comparison should not fail if the sizes doesn't match, but it should match pixels and the color of the Bitmap I am not sure how the native part of Android draws the Bitmap , because sameAs returns true even though the tint color is different. If the size is different, I can create scaled Bitmap from the other and the compare these to. In my source code I use DrawableCompat.setTint with the ImageViews

Fragment stucks when, in OnCreateView, a Bitmap (path from SharedPreferences) is set by onBindViewHolder

主宰稳场 提交于 2020-04-30 06:31:33
问题 I will try to be more specific about my issue. I start saying I've already seen this question that shows the same kind of problem, I guess, but I didn't really understand the right solution. Note: I have created the drawer activity and all navigation dependencies from a template in creating new project step Initially, I found that when, in ShowProfileFragment, I tried to update the header of the navigation drawer, the same issue happened, so when I put that if statement (see code below) to

“Canvas: trying to draw too large bitmap” problem in Android Studio

让人想犯罪 __ 提交于 2020-04-18 03:54:22
问题 When I try to get bitmap from website, Canvas: trying to draw too large problem is occured. So I search this problem on google and many people wrote their solutions, but that solution is about bitmap file in directory drawable. What should I do if the bitmap image taken from the website is too large? This is my code. Thread mThread = new Thread() { @Override public void run() { try { URL url = new URL(postImgUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn

how can I show a video thumbnail from a video path?

左心房为你撑大大i 提交于 2020-04-11 04:55:32
问题 I want to show a video thumbnail in an ImageView from a video path on storage. Is there a function that takes a video path and returns a bitmap of a thumbnail? I get the video path by this code: public ArrayList<String> getAllMedia() { HashSet<String> videoItemHashSet = new HashSet<>(); String[] projection = {MediaStore.Video.VideoColumns.DATA, MediaStore.Video.Media.DISPLAY_NAME}; Cursor cursor = getContext().getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection,

dealing with many full screen png to avoid OOM

倾然丶 夕夏残阳落幕 提交于 2020-01-24 14:14:12
问题 I have an app for my own use to communicate with arduino. There are custom shape buttons, so i drawn them in PNG as single background, added Buttons with android:background="@android:color/transparent" to make them transparent on top almost the size of custom buttons. In this image you can see: 1. Background - black background with dark blue buttons drawn as single png. 2. Orange png - same size as background, drawing it with match parrent option. 3. Invisible button - with transparent option