android-5.0-lollipop

Lint error with Fragments on Android L: “This method is not overriding anything”

萝らか妹 提交于 2019-12-04 20:42:24
问题 This method is not overriding anything with the current build target, but will in API level 11 (current target is 1). How do I neutralize this error? The app compiles and runs. I'm using gradle: android { compileSdkVersion "android-L" buildToolsVersion "19.1.0" defaultConfig { applicationId "com.codepath.apps.restclienttemplate" minSdkVersion 14 targetSdkVersion "android-L" } .... } According to to the <uses-sdk> docs, if minSdkVersion is absent it defaults to 1, so I'm thinking lint doesn't

Detect if resolution is too high on Android Lollipop

…衆ロ難τιáo~ 提交于 2019-12-04 20:37:11
I have to display some pictures in an ImageView. Some of them may have a resolution too high that gives me W/OpenGLRenderer﹕ Bitmap too large to be uploaded into a texture (3744x5616, max=4096x4096) I used this method to detect this situation: public boolean isResTooHigh() { int[] maxSize = new int[1]; GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxSize, 0); return (maxSize[0] < width) || (maxSize[0] < height); } where width and height are provided by the source of the pictures. But now on my Nexus 4 running Lollipop and my emulators, maxSize[0] is always 0. So, how do I detect this problem

Android Camera2 Output sizes

怎甘沉沦 提交于 2019-12-04 20:31:54
问题 I have tested new Camera2 API on Android Lollipop. I want to fetch supported preview size: StreamConfigurationMap streamConfigurationMap = cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); Size[] sizes = streamConfigurationMap.getOutputSizes(SurfaceTexture.class); and the maximum preview size is 1440x1080px on Samsung Galaxy Tab S that has 2560x1600px resolution. So my previewSize is 1440x1080px and TextureView surface size is 2560x1600px so image is distorted.

Cannot stop AudioTrack on Android 5

落花浮王杯 提交于 2019-12-04 20:19:17
I cannot stop playback of an AudioTrack on a Nexus 4 running Android 5.0.1. Am I doing something wrong? The code is very simple (it's actually just a test app) and it works perfectly on devices running 2.3.6 and 4.4. Here's the relevant portion: mPlugReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if(Intent.ACTION_HEADSET_PLUG.equals(intent.getAction())) { boolean plugged = intent.getIntExtra("state", 0) == 1; if(plugged) { log.debug("audio device plugged"); boolean mic = intent.getIntExtra("microphone", 0) == 1; if(mic) { log.debug(

AudioRecord records intermittent sound in Android L Developer Preview

女生的网名这么多〃 提交于 2019-12-04 18:59:01
问题 I'm recording sound with AudioRecord in PCM16LE format, 8000Hz, 1channel. It records ok in Android versions 2.3.3-4.4.4, but records strange intermittent sound in Android L(5.0) Developer Preview (on nexus 5, nexus 7 and emulator). Here is the sample of recorded sound (the first half - recording, the second half - playback): https://www.dropbox.com/s/3wcgufua5pphwtt/android_l_sound_record_error.m4a?dl=0 I tried to play recorded sound using different sample rate (4000, 16000) and as 8bit but

Native crashes received in Samsung devices only with Lollipop 5.0 & 5.1 versions

纵饮孤独 提交于 2019-12-04 18:22:13
问题 Since past 2 months, we have started receiving native crashes in our developer console only for some Samsung devices. Here is the crash trace *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/ha3gjv/ha3g:5.0/LRX21V/N9000QXXUEBOG3:user/release-keys' Revision: '11' ABI: 'arm' pid: 10422, tid: 10478, name: AsyncTask #2 >>> com.sample.app <<< signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1c r0 131413a0 r1 131413a0 r2 b1687070 r3 00262827 r4

How to access Android Lollipop DocumentFile files via NDK?

♀尐吖头ヾ 提交于 2019-12-04 18:07:38
问题 How is it possible to access files which are generated from a DocumentFile in Android KitKat/Lollipop in Native JNI Code, so I can use fopen, fread, etc. I'm particular asking this to access the external SD-Card files via the NDK. 回答1: You can use file descriptors: ParcelFileDescriptor filePfd; DocumentFile file; filePfd = getContentResolver().openFileDescriptor(file.getUri(), "w"); int fd = filePfd.getFd(); This int fd can be passed to JNI and used as usual C++ file descriptor: FILE* file =

How to close ACTION_USAGE_ACCESS_SETTINGS intent when user click correct target application?

a 夏天 提交于 2019-12-04 18:01:39
问题 I am using Intent ACTION_USAGE_ACCESS_SETTINGS in setting ( Settings->Security->Apps with usage access ) to use UsageStatsManager in the Lollipop version. public static final int MY_PERMISSIONS_REQUEST_PACKAGE_USAGE_STATS = 1; if(!hasPermission()){ startActivityForResult( new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS), MY_PERMISSIONS_REQUEST_PACKAGE_USAGE_STATS); } First, onCreate() will check the permission for the app. and turn on the Intent if the app has no permission (does not check)

Android L is ignoring shapes as drawable background

对着背影说爱祢 提交于 2019-12-04 17:31:27
问题 I'm testing Android L Preview on my Nexus 5. I've got problem with my app. I've got some TextViews with background set: android:background="@drawable/rounded_textview" And "rounded_textview" is just shape. It is working great below <=API19. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="3dp"> <solid android:color="#999999"/> <corners android:bottomRightRadius="2dp" android:bottomLeftRadius=

Using CardView and RecyclerView in my layout files throws an exception

淺唱寂寞╮ 提交于 2019-12-04 17:15:05
问题 So I've been taking a shot at the Material Design of Android Preview L. I imported both the CardView and the RecyclerView libraries. I use the Android Studio preview version 0.8.0. Have the latest SDK packages installed. Once I use them in my layout files though, the previewer throws an exception for both of them. Here is the exception for the CardView : java.lang.ClassFormatError: Illegal field name "CardView.Dark" in class android/support/v7/cardview/R$style at java.lang.ClassLoader