PeerConnectionFactory in Android Studio 2 has no methods - java

After adding compile 'org.webrtc:google-webrtc:1.0.+' to my build.gradle file I try to init PeerConnectionFactory, but this class has no any useful methods.
What am I doing wrong?
UPDATE:
enter image description here

The last version org.webrtc:google-webrtc:1.0.21217
You can init by following codes
PeerConnectionFactory.InitializationOptions.Builder optionBuilder =
PeerConnectionFactory.InitializationOptions.builder(/* Put context here */);
optionBuilder.setEnableInternalTracer(true);
optionBuilder.setFieldTrials("WebRTC-FlexFEC-03/Enabled/");
optionBuilder.setEnableVideoHwAcceleration(true);
PeerConnectionFactory.initialize(optionBuilder.createInitializationOptions());

First, try to use an specific version like: compile 'org.webrtc:google-webrtc:1.0.20198'
And then make sure you rebuild your project (not only refresh gradle, since it might not be enough for the autocomplete to work).
In your screenshot, it looks like you are trying to autocomplete outside of any method. Since Android Studio tries to only show you valid stuff, it won't display the other methods unless you write it on a valid context (i.e.: inside of some method's implementation).

Related

How to move from a AbilitySlice to a Ability in HarmonyOS?

I am trying to move from an AbilitySlice to an Ability. I tried the below code,
But was it not working as expected.
Operation systemOperation = new Intent.OperationBuilder()
.withBundleName(getBundleName())
.withAbilityName(MainAbility.class.getSimpleName())
.build();
intent.setOperation(systemOperation);
startAbility(intent);
for moving from an AbilitySlice to Ability in Harmony OS?
Try to Delete Simple from getSimpleName. Like following:
Operation systemOperation = new Intent.OperationBuilder()
.withBundleName(getBundleName())
.withAbilityName(MainAbility.class.getName())
.build();
intent.setOperation(systemOperation);
startAbility(intent);
"Not working as expected" generally is not a valid error description. I'd suspect the AbilitySlice might belong to MainAbility and the whole operation might therefore be pointless, as navigation from A to B could not happen. The example which #Gowtham provided has one small difference (which appears to consider the device on which to launch the Intent with Super Device):
.withDeviceId("")
Have you ever tried to start anything else but MainAbility?
I see that you have mentioned that the package name of your target ability is different than the package name of your ability slice in your reply to #Martin.
Then, you need to make sure the bundleName(or package name) specified in the Intent's Operation builder is having the target ability's package name and not the calling ability's/abilityslice's package name.
Operation systemOperation = new Intent.OperationBuilder()
.withBundleName("enter_package_name_of target_ability_here")
.withAbilityName(MainAbility.class.getName())
.build();
intent.setOperation(systemOperation);
startAbility(intent);

How to create a Lottie Alert Dialog in Java

I've tried searching for the Java tutorial regarding creating my LottieAlertDialog, but I can't find any. Everywhere it's in Kotlin, but I need the Java code as my project is in Java.
I've tried creating my LottieAlertDialog in this way:
LottieAlertDialog.Builder alert=new LottieAlertDialog.Builder(context,DialogTypes.TYPE_CUSTOM,
"social.json") //Here social.json is inside assets folder
.setTitle("Social")
.setDescription("social");
alert.build();
But the dialogbox doesn't show, when I run the app. To check whether my alert dialogbox was being created or not I tried testing it by printing the description set in the dialog in a Toast:
Toast.makeText(context,alert.getDescription(),Toast.LENGTH_SHORT).show();
The toast works and its showing "social"! That means the dialog is being created. But unfortunately it doesn't show in my app. What do I do? I've implemented all the dependencies as shown in the below link:
lottiealertdialog
Ok, after much hankering, I finally came to the solution. It's
alert.build().show();
The thing is not related to Kotlin or Java as such, you need to show the dialog once you have built it. So far your code is correct. You just need to show it further like this
LottieAlertDialog.Builder alert = new LottieAlertDialog.Builder(context, DialogTypes.TYPE_CUSTOM,
"social.json")
.setTitle("Social")
.setDescription("Social")
.build()
.show();

How to use GWTQuery-UI

I am trying to unserstand how GWTQuery works, for that I am trying out a simple demo with the slider. As per the documentation at Google (the slider tab is on the bottom left), and using the class AbstractSliderDemo from here, which in turn, is implementing the Demo interface defined here, my onModuleLoad simply contains:
Label e = $("#slider").widget();
Query q = new Query();
q.setupDemoElement(e.getElement());
However on page-load, it is throwing a NullPointer exception. Can anybody guide me how to use it. Probably I am missing something here. (I have added both GWTQuery and GWTQuery-UI jar files to the build path, as well as including <inherits name='gwtquery.plugins.Ui' /> in the XML file).
And here is the directory structure of my project:
GwtQuery-Ui is just a wrapper on jquery-ui. That means that you need to inject the jquery and jquery-ui javascript file. Check the getting started guide og GwtQuery-ui

Cordova plugin accessing activity custom method

I am currently making a Cordova plugin that will have call a method which starts a tween animation on the main activity.
cordova.getActivity().customMethod();
Does not work because the plugin does not know whether the method is implemented or not. How do I do this?
Thanks!
Edit: To clarify my question a little bit better: How do I make a Cordova Plugin start an Android view-animation in the current activity?
Did you add your plugin name to plugins.xml or config.xml(as from version 2.0.0)?
like -->
<plugin name="Your_plugin_name" value="packagename.Your_plugin_name"/>
Edit:
As you are simply calling a method in your activity,I wouldn't want to write a plugin for that...but you can do that just by getting a reference from that activity in the plugin and calling the method.After all the Plugin is implemented in native Java code.But if you have implemented CordovaWebView,then instead I would rather call it directly from the javascript.
In onCreate:
cordovaWebView.getSettings().setJavaScriptEnabled(true);
cordovaWebView.addJavascriptInterface(this, "reference");
In you activity:
public void animate()
{
//do animation
}
In JS :
reference.animate();
Do as you may like.

jquery-mobile spinner loading

i tried to do that while js is creating a timetable... it shows spinner loading..
i tried to do this $.mobile.pageLoading(); $.mobile.pageLoading(true); and also tried to use this plugin http://contextllc.com/tools/jQuery-showLoading
The result is the same.. it shows spinner after he generate time table.. and i don't know why...here is where i tried to use it...
$('#timeDropList').change(function() {
$.mobile.pageLoading(false);
$('div.addedEntry').remove();
drawTemplate();
});
Are you using the right version of jQuery Mobile? Looks like they took away the pageLoading method in 1.0b1 in favor of two separate methods: showPageLoadingMsg and hidePageLoadingMsg. The last reference I see to pageLoading is in 1.0a4.1.
$('#home').live('pagebeforecreate',function(event){
alert('This page was just enhanced by jQuery Mobile!');
$.mobile.loadingMessage = "pagebeforeshow Page...";
$.mobile.showPageLoadingMsg();
});

Categories