how to fix setOpenableLayout in layout Navigation Drawer Activity - android-studio

i have a problem why is setOpenableLayout not working?
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow)
.setOpenableLayout(drawer)
.build();
show error :
error: cannot find symbol
.setOpenableLayout(drawer)
^ symbol: method setOpenableLayout(DrawerLayout) location: class Builder
maybe someone here can help me

What is your gradle config.
Look a problem of sdk versions. Try changing ".setOpenableLayout(drawer)" for ".setDrawerLayout(drawer)".
Anyway, it's possible for your minSdk method setOpenableLayout does not exist yet.

I'd advise to set higher version of androidx.navigation:navigation-ui (say 2.4.1).

Related

use Intent in Kotlin

When we want to move to another Activity using Intent in Kotlin, it gives this error.
In Intent, it doesn't recognize .java after ::class
look:
And when I delete .java, Intent gives an error
Note: My problem was not solved with Invalidate Caches / Restart... option in File
I don't know where the problem is. please help me.
Kinda strange because it seems good to me. Try this.
Remove the lateinit and declare it directly when you need it, maybe it will solve the problem.
val intent = Intent(this, LauncherActivity::class.java)
I don't think the this#KotlinActivity is needed in this case.
Let me know if this fix it
UPDATE
Are you sure the findViewById<TextView>... is correct ? Shouldn't it has a declaration before ? Like
val view = findViewById<>...
The solution is:
In build.gradle (:app) file, in dependencies, you should change appcompat version to 1.4.2.
befor error:
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.0'
...
}
And when I changed the version to 1.4.2, the problem was solved
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
...
}
And make sure the kotlin version is 1.5.0

How to resolve exoplayer error : AAPT: error: attribute fastforward_increment not found?

Firstly I added the exoplayer dependency to my build. After that I made a xml layout with a custom controller and then I wanted to add app:fastforward_increment & app:rewind_increment. But every time I try to build it throws this error message :
AAPT: error: attribute fastforward_increment not found.
I tried to resolve this issue by adding the other dependecies as they were suggesting in one of the forums but it didn't work. Do you know what's causing the issue and how to solve it?
The functions app:fastforward_increment & app:rewind_increment were removed in the version 2.15.0 and replaced by setSeekBackIncrementMs and setSeekForwardIncrementMs in SimpleExoPlayer.Builder. So instead of changing this value in xml file, now you have to change it programatically:
SimpleExoPlayer.Builder builder = new SimpleExoPlayer.Builder(context);
builder.setSeekBackIncrementMs(10000);
builder.setSeekForwardIncrementMs(10000);
SimpleExoPlayer simpleExoPlayer = builder.build();
According to #Kristian answer, app:fastforward_increment and app:rewind_increment were removed. You can set like this:
val player = ExoPlayer.Builder(this)
.setSeekBackIncrementMs(10000)
.setSeekForwardIncrementMs(10000)
.build()
In the new version com.google.android.exoplayer:exoplayer:2.17.1 of Exoplayer, I deleted the parts in XML and added in the code part.
Xml:
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="#+id/playerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
argType:resize_mode="fixed_width"
argType:show_buffering="when_playing"
argType:show_fastforward_button="true"
argType:show_next_button="false"
argType:show_previous_button="false"
argType:show_rewind_button="true"
argType:show_subtitle_button="true"
argType:use_artwork="true"
argType:use_controller="true">
</com.google.android.exoplayer2.ui.StyledPlayerView>
Code:
playerView = ExoPlayer.Builder(this)
.setSeekForwardIncrementMs(10000)
.setSeekBackIncrementMs(10000)
.build()
It worked flawlessly.

Why everytime open a new flutter project this error appear?

I have tried a different kind of ways to resolve the error but still can't resolve, and I'm still a new learner on flutter. But I still can run the whole project well without resolving the error shown.
There is no error that's just ide warning I think, that could be about typo etc, If you click to lamp and show us the suggestions then we can help more.
But I tried this part of code and get different warning and solved it with add # to override such as;
class MainActivity: FlutterActivity(){
#override fun configureFlutterEngine(#NonNull flutterEngine: FlutterEngine){
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
If that's show same you need to check your ide settings, probably there is a missing plugin(Dart or Flutter).

Xamarin Linker : Default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector

With a skeleton project with FirstView from HotTuna package, and with Build linker behavior set to "Link all assemblies", I get the following error:
System.MissingMethodException: Default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector
Using NuGet package v3.1.1 for all MvvmCross (4 packages)
LinkerPleaseInclude file does have the line
[MonoTouch.Foundation.Preserve(AllMembers = true)]
Using the latest stable build:
On PC:
Xamarin for VS 1.12.278
Xamarin.iOS 1.12.278
Mac:
Xamarin.iOS 7.2.2.2
Of course with Linker behavior of SDK only, it runs fine. Any suggestions anyone?
Solved; So, with the basic project, there were three consecutive errors in the following order:
System.MissingMethodException: Default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector
can be resolved either by --linkskip=Cirrious.Core (ugly), or by including the following in LinkerPleaseInclude.cs
public void Include(MvxPropertyInjector injector){
injector = new MvxPropertyInjector ();
}
Next error is:
Cirrious.CrossCore.Exceptions.MvxException: Failed to construct and initialize ViewModel for type {0} from locator MvxDefaultViewModelLocator - check MvxTrace for more information
This one is difficult; Simple fix is to ofcourse to do a --linkskip=portableLibrary, or to crate an instance of the ViewModel somewhere (perhaps in LinkerPleaseInclude.cs); problem with the second approach at-least in my case is, most of my VM doesn't have a parameter less constructor, and obviously using IOC in this case wouldn't help.
Final Error:
System.ArgumentNullException: missing source event info in MvxWeakEventSubscription
Parameter name: sourceEventInfo
Either use --linkskip=System (ugly), or add the following to LinkerPleaseInclude.cs
public void Include(INotifyPropertyChanged changed)
{
changed.PropertyChanged += (sender, e) => {
var test = e.PropertyName;
};
}
This was enough for my basic project to run with LinkAllAssemblies, Using LLVM optimizer, and Use SGen collector.
Hope this will help anyone looking for a solution.
I hit this when my XCode was out of sync with the latest Xamarin on my Mac. Upgrading XCode to the latest resolved the problem.

Can't get LineChartBuilder to compile

I'm creating an application that uses JavaFX 2.2 and have run into a problem. I'm trying to use a LineChartBuilder, like so:
LineChart<Number, Number> chart = LineChartBuilder.<Number, Number>
create()
.XAxis(NumberAxisBuilder.create().label("X axis").build())
.YAxis(NumberAxisBuilder.create().label("Y axis").build())
.build();
However, I'm getting the following compiler errors:
java: reference to create is ambiguous, both method create() in
javafx.scene.layout.RegionBuilder and method <X,Y>create() in
javafx.scene.chart.LineChartBuilder match
and
java: cannot find symbol
symbol: method XAxis(javafx.scene.chart.NumberAxis)
location: class javafx.scene.layout.RegionBuilder<capture#1 of ?>
I know the first error means LineChartBuilder descends from RegionBuilder and both define a create() method, and the second means it's assuming the method comes from RegionBuilder and therefore cannot find the XAxis method. I've even tried casting it,
LineChart<Number, Number> chart =
((LineChartBuilder<Number, Number, ?>)
LineChartBuilder.<Number, Number>create())....
But I get the same compiler errors.
My question is, is this a mistake in LineChartBuilder or am I using it wrong? Maybe there's even a workaround?
Are you sure you are running with JavaFX 2.2 and not a JDK8 pre-release?
JDK8 will experience these issues with builders coded for JavaFX 2.2: see RT-24272.
Workaround is to use new LineChart(xaxis, yaxis). See also the Oracle forum thread post on this issue.

Resources