yesterday i have updated to the latest version of xamarin.ios, the problem i'm experiencing is that existing apps, are not working anymore with datasources, for example i have a simple tableview with my custom datasource, everything run fine with no exception, but when it is executed GetCell or RowsInSection for example are not called.
Do you have any idea why? there is maybe some change to apply on my code to make it working?
I have found it, on older version the UITableViewDataSource worked fine without it, just adding this override fixed it.
public override int NumberOfSections (UITableView tableView)
{
return 1;
}
Related
Ok, I have some fictional class
public class TEMP {
String data;
View.OnClickListener onClickListener = new View.OnClickListener() {
#Override
public void onClick(View v) {
if (data != null) {
}
}
};
}
And it looks like this in Android Studio:
If I collapse all - it looks ugly:
If I remove that if block inside onClick() - it looks good:
Why is this happening and how can I solve this issue?
It's been a while, so I'm not sure how helpful this is.
This is folding the function into a lambda-like visual structure with Java 8 lambda-notation. Single method interfaces are (almost) equivalent to lambdas in Java 8. Android Studio currently does NOT support Java 8 lambda notation (details found at the bottom of this answer: Is it possible to use Java 8 for Android development?).
A workaround IS available for Java 8, based on the Jack toolchain. Here is the the workaround, and here is the deprecation of the Jack toolchain.
Another note is that according to here and here, Android Studio 2.4 preview 4 and later appears to support actual lambda notation. Note that these are previews, and the latest official version is 2.3.2.
As for how to fix it, I don't believe it is possible. You may be able to use the region feature to duplicate what you are trying to achieve. The link above is a how-to sort of thing.
When running unitTest on AndroidStudio (1.4), my below test fail as per title i.e. java.lang.NoSuchMethodError: org.assertj.core.api.Assertions.assertThat(Ljava/util/Map;)Lorg/assertj/core/api/MapAssert;
#Test
public void mapTest() {
Map<String, String> map = new HashMap<>();
map.put("Key1", "Value1");
map.put("Key2", "Value2");
Assertions.assertThat(map).isNotNull();
}
When I run it from command line using gradlew command, it passed. I'm already pointing my Java to jdk1.8.0_66.jdk. Anyone knows why?
(p/s: I get the latest AndroidStudio 2.0 Preview 5, my test fails massively. So I decided to stay with the older version of Android Studio).
Trying to search for help and found this link https://github.com/joel-costigliola/assertj-core/issues/395. Apparently he also face the same issue on IDE. Any clue what's the cause?
I would double check the classpath.
Use assertj core 1.7.1 - it's a version depending on java 6 whcih I'm sure is Android compatible.
Hope it helps
I have eclipse 3.7 indigo; I installed gwt plugin and its designer; The problem is (time after time) when I add new widget X to composite the
palette (keeps widget selected)
components (doesn't show the new widget in the tree)
properties (doesn't show the new widget properties)
...so I cannot select another widget unless I resize the whole eclipse application to force its GUI repaint :(
It seems like palette and other managers don't get report "widget was added from windowbuilder" or similar :(
Moreover, I cannot edit widget's text if I have input method as "System" which is the default on btw so the only one input method which works is "X Input Method" but anyways it doesn't solve the mentioned focus regain problem;
That makes eclipse indigo really hard to use; So my question is... how to fix that?
p.s.
eclipse 3.7 (indigo)
gwt plugin - https://dl.google.com/eclipse/plugin/archive/3.6.0/3.7
gwt designer - http://dl.google.com/eclipse/inst/d2gwt/latest/3.7
gwt sdk 2.2
jdk 1.7
jre 1.7
OS Linux x64
Thanks
I had to do my own research concerning the issue; I noticed there is some kind of "jobs order conflict" or similar with the default constructor based code style as :
public class MyTestUI extends Composite {
private FlowPanel flowPanel;
public MyTestUI() {
flowPanel = new FlowPanel();
initWidget(flowPanel);
}
}
...so, as a workaround, I had to play with code generator as;
window -> preferences -> windowbuilder -> gwt
(combobox) method name for new statements : initComponents
variable generation : field
statement generation : flat
just to avoid having in-constructor init as a result I have code generated as :
public class MyTestUI extends Composite {
private FlowPanel flowPanel;
public MyTestUI() {
initComponents();
}
private void initComponents() {
flowPanel = new FlowPanel();
initWidget(flowPanel);
}
}
...btw there is a problem with focus regain if input method is "System" and initComponents() method generated first time; so before starting adding widgets I had to select "X input method" to avoid synch-ed jobs; So "X input method" needs to be the default one, as I can get it :)
EDIT :
The effect I faced very looks like bug 388170; So I tried to modify eclipse.ini argument as
-Djava.awt.headless=true
It seems like the headless helps a bit but anyways eclipse sometimes does hang when using windowbuilder especially DnD :P
Anyways I want to point I faced the mentioned issue first time cause similar windows x32 eclipse indigo version works pretty fine with gwt;
p.s.
The solution is not final (the hang problem still occurs on DnD evens) and I am still looking for a more optimal one; So do comment if you have some helpful tips or ideas;
So I updated my Xamarin install today to the latest stable version. Since the update, my app won't run on iOS (runs fine on Android)... the error is that it can't resolve the constructor.
Autofac.Core.DependencyResolutionException: No constructors on type 'FutureState.AppCore.Migrations.Migration001' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
My original constructor is
public Migration001(IUserRepository userRepository,
IRoleRepository roleRepository,
IPermissionRepository permissionRepository,
IPasswordHasher passwordHasher)
{
_userRepository = userRepository;
_roleRepository = roleRepository;
_permissionRepository = permissionRepository;
_passwordHasher = passwordHasher;
MigrationVersion = 1;
}
but I even tried changing it to service location just to see if Autofac would find the constructor.
public Migration001()
{
_userRepository = App.Container.Resolve<IUserRepository>();
_roleRepository = App.Container.Resolve<IRoleRepository>();
_permissionRepository = App.Container.Resolve<IPermissionRepository>();
_passwordHasher = App.Container.Resolve<IPasswordHasher>();
MigrationVersion = 1;
}
but unfortunately, it results in the exact same issue.
Autofac.Core.DependencyResolutionException: No constructors on type 'FutureState.AppCore.Migrations.Migration001' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
what would cause something like this? This is a Xamarin.Forms app, so the exact same code is run without issue on Android.
Looks like it was an issue with the Xamarian release at that time. I've re-updated to the latest version (yesterday) and no longer have this issue.
Further there were a number of breaking bugs in the September 2014 releases, so if you're on 3.5... upgrade.
I had similar issue after upgrading Xamarin iOS SDK to Alpha (3.9.289). Changing Linker Behaviour to 'Don't link' solved my problem.
Changing Linker Behaviour to Link Framework SDKs Only solved my problem.
I would like to define a custom presenter to customise my UI a little, to implement a split view on iPad and so on. I defined this class:
class ProjectPresenter : MvxTouchViewPresenter
{
public ProjectPresenter(UIApplicationDelegate applicationDelegate, UIWindow window) : base(applicationDelegate, window)
{
}
public override void Show(MvxViewModelRequest request)
{
IMvxTouchView viewController = this.CreateViewControllerFor(request);
this.Show(viewController);
}
}
And I registered it in my MvxTouchSetup class like so:
protected override IMvxTouchViewPresenter CreatePresenter()
{
MvxTrace.Trace("Creating the presenter!");
return new ProjectPresenter(this.ApplicationDelegate, this.Window);
}
However, breakpoints in the Show() method are never hit. I tried adding breakpoints to all overloads of Show(), ChangePresentation(), etc, but they are never hit. Now, I know that Xamarin.iOS is fairly unreliable where breakpoints are concerned but even putting in trace methods yields no joy. I even replaced the CreatePresenter() method with a method that throws an exception and the app didn't crash.
Other modifications to my application show up when I deploy them, so this isn't some sort of caching problem, although I have cleaned both the sources on my PC and on my Mac as well. Furthermore, the breakpoint in the constructor of my setup class is being hit, so this is perhaps not even a Xamarin-related problem at all.
I'm guessing that I'm either relying on older documentation or I'm doing something very very silly (I'm guessing the latter).
The only reason I can think that CreatePresenter wouldn't be called is if you are using the older 'presenter-based' constructor for your Setup
MvxTouchSetup provides two different constructors:
protected MvxTouchSetup(MvxApplicationDelegate applicationDelegate, UIWindow window)
{
_window = window;
_applicationDelegate = applicationDelegate;
}
protected MvxTouchSetup(MvxApplicationDelegate applicationDelegate, IMvxTouchViewPresenter presenter)
{
_presenter = presenter;
_applicationDelegate = applicationDelegate;
}
from https://github.com/MvvmCross/MvvmCross/blob/v3/Cirrious/Cirrious.MvvmCross.Touch/Platform/MvxTouchSetup.cs#L39
By default in Nuget-based projects and in most of the MvvmCross samples, the first of these is used.
However, the second form actually existed first and so it's still around for historical reasons - to prevent older apps from breaking. If you use it, then the CreatePresenter() is not used - it's not needed because you've supplied a presenter during construction.