Android L - android.graphics.outline - android

According to the android developer page for the developer preview of L, it's possible to use the Outline class & define outlines for view's to display the shadows in the correct way.
(http://developer.android.com/preview/material/views-shadows.html#shadows)
In my case, the "L"-sdk I use, didn't found it. Therefore I couldn't import and use the class.
According to the test project, stored in sdk/samples/android-L/ui/views/Elevation/ElevationDrag this class should be stored in "android.graphics.outline", but even in this project it can't be located correctly.
Is this feature not implemented in the developer preview yet or did I missed something?

Finally got it.
It's a bug in android studio. I just added manually the import to my activity:
import android.graphics.Outline
It will be shown as error, but it can compile & run.
I hope they will fix this soon.
EDIT: I created an issue here: https://code.google.com/p/android/issues/detail?id=72788&q=android%20studio%20android%20l&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
It looks like, they're working on it.

The same problem than you but your answer it didn't work for me, I am trying to import
import android.graphics.outline;
And de output is:
Error:(7, 24) error: cannot find symbol class outline
The build.gradleseems to be well configurated with the
compileSdkVersion 'android-L'
sentence
** Fixed
the right import is: import android.graphics.Outline;

Related

Cannot locate ChangeText class/symbol

I am trying to add some animation in my Android app for a text change on a TextView.
I found a post with sample:
Smooth text change in android animation
Sample code:
TransitionManager.beginDelayedTransition(transitionsContainer,
new ChangeText().setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN));
I have imported the following package:
import androidx.transition.TransitionManager;
However, when I use this, I get an error in Android Studio: Cannot resolve symbol ChangeText
What am I missing? Please help!
The original Answer mentions that a library is needed:
If you want to support Android 4+. check out the Transitions Everywhere lib. You can achieve all sorts of different animations with backward compatibility.
Here you can find some examples.
Therefore you might need to install the library via gradle and then import it like so:
import com.transitionseverywhere.ChangeText;
or
import com.transitionseverywhere.*;

Android Studio - Auto Import won't work even after 'fixing' the problem

Straight forward -> The Auto import function won't work on my Android Studio.
Example: I declare a variable 'Button btn' and I get no option to auto import (ALT+Enter) the Button library.
I have tried by going to Settings->General->Auto Import and changed the settings to this:
Screen shot
It still ain't working. So I tried to Invalidate caches/restart, still not working.
I have been searching for help all day, without really finding any helpful solution.
Change the value of the option Insert imports on paste to Ask instead of All. It should normally ask you to import new librairies that you need to have.

Android, Type argument listadapter

so i'm following a guide online to make a room db. In the adapter section i followed his way of doing it but when i did it, i keep having the "No Type Argument expected for Interface ListAdapter".
Error example: https://imgur.com/kPT7DkE
Here's the whole project so far on github.
https://github.com/OlivierLabelle/BudgetProject/tree/master/app/src/main/java/com/example/android/budgetproject
And the guide i was following.
https://medium.com/#trionkidnapper/recyclerview-more-animations-with-less-code-using-support-library-listadapter-62e65126acdb
So with the help of devboi, i found out i was using the wrong import.
In the top right corner on the Dev documentation it show the right import.
https://imgur.com/vGrCOVd
And here how the import on my project should look like.
import android.support.v7.recyclerview.extensions.ListAdapter
Just came across this very problem myself.
If you're using AndroidX/Jetpack/whatever the official name is I'm still new at this, Android Studio might
import android.widget.ListAdapter
automatically, but the one you want is
import androidx.recyclerview.widget.ListAdapter
From what I see in your code, you should replace ListAdapter<Transaction> with ListAdapter<Transaction, Viewholder>.
You can see an example in the docs here :(https://developer.android.com/reference/android/support/v7/recyclerview/extensions/ListAdapter.html), where ListAdapter has 2 arguments inside the diamonds: one for the list-object and the other for your custom viewholder.
Hope this helps.

Android - IContentService cannot be resolved

In my project I need to use IContentService, and I've used the right import (import android.content.IContentService) and yet android studio tells me 'Cannot resolve symbol IContentService'.
I know IContentService is an actual class, because it is used in ContentResolver.getContentService();
Anyone know how I can get this import to work?
You cannot use this class directly.
You can see in the source code (e.g. here for Marshmallow) that this class is tagged with the #hide annotation.
The class can only be used by reflection as shown here (with all it's disadvantages).
BTW: ContentResolver.getContentService() is also a hidden method (see here).

Android: cannot find symbol for my own imported class

Okay, this is driving me absolutely nuts. Relevant info:
I'm using Android Studio
I'm trying to set up a gaussian blur from here: https://stackoverflow.com/a/14556162/2170400
In my src/com/myprojectname folder I have, among others, the following files: AndroidImage.java, IAndroidFilter.java, ConvolutionMatrix.java and GaussianBlur.java. In IAndroidFilter.java I need to
import com.myprojectname.AndroidImage;
However I get a message saying "Cannot resolve symbol 'AndroidImage'". In the auto-complete menu that pops up while I'm typing the import statement I can see EVERY SINGLE CLASS in my src/com/myprojectname folder EXCEPT AndroidImage, which I can clearly see in the explorer.
I've quit and re-opened Android Studio several times, I've re-synced everything, I've deleted then re-created the AndroidImage class, I've tried to import AndroidImage in other classes with the same failed result as in the IAndroidFilter class...
Why is it that I can't import this class? Seriously, why? I'm at a total loss for further fixes to try.
Check to make sure your AndroidImage.java file has this at the top:
package com.myprojectname.AndroidImageProject;
Or whatever the package is.

Categories

Resources