i m using cocos2d-x version 3.2 and can't use Transition with animation between two scene.
ndk-stack show this error :
cocos2d::Scheduler::unscheduleAllForTarget(void*)+55
caused in this Class CCScheduler.cpp (Line 534)
HASH_FIND_PTR(_hashForTimers, &target, element);
is this a know issue ? or maybe i m doing some thing wrong in my code ?
thanks
class FirstScene : public Scene {
....
scene()...
init(){
auto overlay = NodeInFirstScene::create();
this->addChild(overlay);
}
}
Overlay
Class NodeInFirstScene : public Node {
void NodeInScene1::ButtonPressed() {
Director::sharedDirector()->replace(TransitionFade::create(1.2,SecondScene::scene());
}
}
SecondScene
Class SecondScene : public Scene {
//
scene()....
init()...
}
if i use
Director::sharedDirector()->pushScene it work fine !!
i resolve it,
First : Add method in header :
virtual void release();
virtual void onExit(); //
Second : Release any objects inside my custom class.
CC_SAFE_RELEASE(mObject);
unscheduleAllSelectors();
...
Voila,
Related
I'm trying to create a custom Debug Tree class to get the same result as the following:
I have followed this Stackoverflow answer:
Log method name and line number in Timber
But using that answer gives me two problems:
Implementing the custom Debug Tree class does not log anything when I use more than one method.
public class MyDebugTree extends Timber.DebugTree {
#Override
protected String createStackElementTag(StackTraceElement element) {
return String.format("(%s:%s)#%s",
element.getFileName(),
element.getLineNumber(),
element.getMethodName());
}
}
public class BaseApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new MyDebugTree);
}
}
}
The above causes it to not log at all.
If I use only return element.getFileName(); it successfully logs that one error.
The second problem I'm having is that using a custom DebugTree class does not give me the same results as using err.getStackTrace()[0].getLineNumber().
}, err -> {
Timber.e("Method name: " + err);
Timber.e("Method name: " + err.getStackTrace()[0].getMethodName());
}
The custom Debug Tree class does not display the name of the method I'm trying to log.
Why is it not logging when I use all three methods?
Also how can I get it to log like it would using
err.getStackTrace()[0].getMethodName()?
I'm using 'com.jakewharton.timber:timber:4.7.1'
You seem to be doing it right. I recreated your code in kotlin (programming language should not matter) and i was able to show my logs.
MyDebugTree.kt
class QueenlyDebugTree : Timber.DebugTree() {
override fun createStackElementTag(element: StackTraceElement): String {
return "(${element.fileName}:${element.lineNumber})#${element.methodName}"
}
}
force log using an actual exception:
try {
throw RuntimeException("Hello World")
} catch (e: Exception) {
Timber.e(e)
}
i got a log:
So, from what i saw from your code, its most probably because you have a compact logcat view. To update your logcat view, follow these steps:
1. Make sure you have standard view selected
2. Configure standard view
3. Make sure Show tags is selected and tag column is at max(35)
Godot version: 3.2.3
Issue description:
I am new at using Android Plugins in Godot, so I created this simple plugin with only one method.
public class GodotProva extends GodotPlugin
{
public GodotProva(Godot godot) {
super(godot);
}
#NonNull
#Override
public String getPluginName() {
return "mylibrary";
}
}
I tried to use it in Godot, with the following code:
func _pressed():
if Engine.has_singleton("mylibrary"):
var singleton = Engine.get_singleton("mylibrary")
print(singleton.getPluginName())
I created an apk and installed it on my Android device. The problem is that when I press the button (and the function _pressed() is called), I can see from the logcat the error Nonexistent function 'getPluginName' in base 'JNISingleton'
I am sure that the plugin is found, because the "singleton" variable is not null.
What am I doing wrong?
I found out that in Godot I can only call custom functions. The methods of the class GodotPlugin (such as getPluginName, getPluginMethods...) cannot be directly called.
In my case, I needed to define methods in getPluginMethods in my GodotPlugin like this:
public void firstMethod() {
// TODO
}
public void secondMethod() {
// TODO
}
#SuppressWarnings("deprecation")
#NonNull
#Override
public List<String> getPluginMethods() {
return Arrays.asList("firstMethod", "secondMethod");
}
I don't know why this case is not documented, but I wasted a lot of time on this and I think it would be useful for other people...
I am trying to override the default behavior of the Android button renderer in Xamarin Forms. I have leveraged (not stolen;) the source code from https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual/create and have created this:
namespace Patron.Droid.Renderers
{
public class MixedCaseButtonRenderer : Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer
{
public MixedCaseButtonRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Button> el)
{
base.OnElementChanged(el);
if (el.OldElement != null)
{
// Cleanup
}
if (el.NewElement != null)
{
var button = (Button)this.Control;
button.SetAllCaps(false);
}
}
}
}
But when I build it, I get the following errors
Severity Code Description Project File Line Suppression State
Error CS0115 'MixedCaseButtonRenderer.OnElementChanged(ElementChangedEventArgs<Button>)': no suitable method found to override Patron.Android C:\Users\ThomH\workspace\patron\Patron\Patron\Patron.Android\Renderers\MixedCaseButtonRenderer.cs 22 Active
Error CS0311 The type 'Android.Widget.Button' cannot be used as type parameter 'TElement' in the generic type or method 'ElementChangedEventArgs<TElement>'. There is no implicit reference conversion from 'Android.Widget.Button' to 'Xamarin.Forms.Element'. Patron.Android C:\Users\ThomH\workspace\patron\Patron\Patron\Patron.Android\Renderers\MixedCaseButtonRenderer.cs 22 Active
Error CS1503 Argument 1: cannot convert from 'Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Android.Widget.Button>' to 'Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.Button>' Patron.Android C:\Users\ThomH\workspace\patron\Patron\Patron\Patron.Android\Renderers\MixedCaseButtonRenderer.cs
Button exists in both Android.Widget and Xamarin.Forms. You need to specify which namespace you mean to use
I am trying to get rid of the shadow that is being displayed at the bottom of a button in android built using xamarin forms. I have tried all that I could. But I have not achieved it.
I have attached an image for reference.
I request your'l to help me and put me out of my misery.
Thanks in advance
1) Create custom control and derive it from Button.
public class ButtonWithoutShadow : Button
{
}
2) Create custom renderer
[assembly: ExportRenderer(typeof(ButtonWithoutShadow), typeof(ButtonWithoutShadowRenderer))]
public class ButtonWithoutShadowRenderer : ButtonRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.Elevation = 0;
}
}
}
3) In xaml page use this button:
<controls:ButtonWithoutShadow TextColor="White" HorizontalOptions="Center" WidthRequest="185" HeightRequest="52" BackgroundColor="#ffcd00" Font="Roboto-Regular" FontSize="23" Text="Поиск" BorderRadius="0" BorderWidth="0" />
[assembly: ExportRenderer(typeof(Button),typeof(FlatButtonRenderer))]
namespace Project.Droid
{
public class FlatButtonRenderer : ButtonRenderer
{
protected override void OnDraw(Android.Graphics.Canvas canvas)
{
base.OnDraw(canvas);
}
}
}
<Button BackgroundColor="Transparent" Text="ClickMe"/>
Source : https://stackoverflow.com/a/39966574/7794690
For me, only thing that removed the shadow was doing this in a custom button render:
Control.StateListAnimator = null;
It may be dependent on API level, though, so might also require:
Control.Elevation = 0;
I'm currently trying to develop an application under Android using Mono.
I'd like to add support for plugins to my application so additional features could be brought to it.
I was able to load simple .dll at runtime in my program, however whenever I try creating a dll implementing both my interface and a custom activity, an exception of type Java.Lang.NoClassDefFoundError is thrown.
There is the class inside the dll code:
[Activity (Label = "Vestiaire")]
public class Vestiaire : Activity, IModule
{
public string Name { get; set; }
public string Version { get; set; }
void OnClickVestiaireButton(object sender, System.EventArgs e)
{
;
}
public void InitVestiaireModule()
{
Run();
}
public Type LaunchActivity ()
{
return typeof(Vestiaire);
}
public void Init()
{
Name = "Vestiaire Module";
Version = "0.1";
}
public void Run()
{
}
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
}
}
The line responsible for the exception: (from the program core)
LoadedPlugin.Add((IModule)(Activator.CreateInstance(Plugin)));
Things I'm actually wonderring are:
- Is it possible to actually achieve what i'm trying to ?
If yes, help would be apreciated on that problem :P
Otherwise what would be the best alternative ?
Global point is to be able to load a custom menu at runtime loaded from a dll.
Thanks.
i think the key to your problem is that the Activity needs to be registered in you Manifest.xml file.
For Activities in you main app, MonoDroid does this for you - but I don't think this will work for your plugin.
Things you could try are:
putting the Activity in the Manifest yourself (MonoDroid does seem very capable at merging these files)
if that doesn't work, then you could try using a Fragment instead - and loading the Fragment into a custom FragmentActivity in your main app.