android-support-library

MediaBrowserServiceCompat vs mediaSessionCompat?

假如想象 提交于 2019-12-05 08:20:34
问题 I just developed a music app (local songs) When trying to build playback control on lock-screen and notification using mediaSessionCompat I found ianhanniballake's following link: https://medium.com/google-developers/mediabrowserservicecompat-and-the-modern-media-playback-app-7959a5196d90#.kfvx5jfyn Though the blog was nicely explained, I didn't understand the difference between mediaSessionCompat and MediaBrowserServiceCompat. Can someone explain why MediaBrowserServiceCompat is used? Is it

PercentRelativeLayout - layout_width missing warning

故事扮演 提交于 2019-12-05 08:19:45
I'm trying out PercentRelativeLayout from the support library, and the docs just ask me to specify an app:layout_widthPercent property. However, when I do that, Android Studio gives me a red warn saying that the layout_width is unspecified. Other than suppressing the warning, is there a way around this? For example: <android.support.percent.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.design.widget.TextInputLayout android:id="@+id/expiry_month_wrapper" app:layout_widthPercent="25%" android:layout_height="wrap_content">

Failed to find: com.android.support:support-v4:22.2.0

做~自己de王妃 提交于 2019-12-05 07:27:56
I am trying to do an application but there seems to be some error with the gradle files now. It was working fine until I upgraded the support libraries. I was working with api 21 which worked fine, but then i upgraded to api22 and changed the gradle files accordingly.. Now this error shows up. Error:Failed to find: com.android.support:support-v4:22.2.0 This is my current gradle file : apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example.sampleapp" minSdkVersion 12 targetSdkVersion 22 versionCode 1

Fragment setuserVisibleHint true but getActivity returns null

痴心易碎 提交于 2019-12-05 06:31:35
I've been doing some logic inside of a fragment's setUserVisibleHint() method. I was always checking if isVisibleToUser is true and then used getActivity to return the activity. This was working well (100% of the time) until I updated the support library to the latest( support:appcompat-v7:24.2.0 ). Now getActivity always returns null. Are there some changes to the support library that explain this behaviour? @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(false); if (isVisibleToUser) { getActivity() <- null } I'm a bit late to the party but maybe

Why won't Android Support Libraries work in my project?

天大地大妈咪最大 提交于 2019-12-05 06:25:01
Using Android Studio, I followed the steps at https://developer.android.com/tools/support-library/setup.html as acurately as I could, but it told me the following error: Error:Could not find method compile() for arguments [com.android.support:appcompat-v7:18.0.+] on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@18899229. Please install the Android Support Repository from the Android SDK Manager. Open Android SDK Manager But I have already installed the Support Repository and Library! Since I also got an error saying compile doesn't belong in the

Collapsing toolbar with image, tabs and FAB

感情迁移 提交于 2019-12-05 05:46:53
问题 I'm having difficulties trying to implement the toolbar as in images below: However, I've failed to add the Floating Action Button like shown on image. I'm using Googles design support library. Any ideas? My current XML code: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"

NullPointerException with ProgressBar using ActionBarCompat

时光毁灭记忆、已成空白 提交于 2019-12-05 05:44:54
I'm using ActionBarCompat in support-v7-r18. When trying to show an indeterminate progress, it works on Galaxy S3 Android 4.1.2 but doesn't on Galaxy Ace Android 2.3.3. I can't figure why. The code raising the exception : @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... final ActionBarActivity activity = this; content = (WebView) findViewById(R.id.webContent); content.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); activity

FAB (floating action button) doesn't float

╄→гoц情女王★ 提交于 2019-12-05 05:28:38
I've tried to use the floatingactionbutton element but it doesn't float in UI layout, the floating button occupies part of the layout and isn't over the component, in my case is a viewpager, button doesn't float this is my layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" tools:context="com.frases.frases.FraseMain" android:orientation="vertical"> <android.support.v7.widget.Toolbar xmlns:android

ViewPager setCurrentItem freezes UI thread

安稳与你 提交于 2019-12-05 05:12:51
I am using a ViewPager from Android support v13 and I'd like to scroll to a specific item using setCurrentItem(int) , but when I try to scroll more than 2 pages the application freezes, and after a few seconds the system shows an ANR window. I tried to increase the offscreen screen limit using setOffscreenPageLimit(2) , that way it did not freeze when i tried to scroll 2 pages, but did the same for 3 pages. My problem is that my fragments are pretty memory consuming so I would not like to have too much in memory. I used the same code with support library v4, but I had to update it to v13 to

Stop Android Studio from using Support Library

僤鯓⒐⒋嵵緔 提交于 2019-12-05 05:06:23
I'm trying to get my Android project in Android Studio to NOT use the Support library. My issue is that when I use fragments it is expecting support fragments and causing the app to crash. My Min SDK is 14 and my Target SDK is 19. My understanding is that because I'm targeting these versions I should not need the support library. Correct me if I'm wrong. I'm trying to correct this error java.lang.ClassCastException: com.google.android.gms.maps.MapFragment cannot be cast to android.support.v4.app.Fragment . And I am aware I can fix it by just using SupportMapFragment instead. But I do not want