I am new to Blackberry development and Im trying to simple get a BrowserField working.
I get this errormessage:
Tried reinstalling JDE etc. etc. but the app always gets an error when I run it on the simulator..
Any ideas?
Here is my code:
package mypackage;
import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
/**
* This class extends the UiApplication class, providing a graphical user interface.
*/
public class HelloBlackBerry extends UiApplication {
private MainScreen _screen;
private BrowserField _bf2;
HelloBlackBerry()
{
_bf2 = new BrowserField();
_screen = new MainScreen();
_screen.add(_bf2);
pushScreen(_screen);
_bf2.requestContent("http://www.blackberry.com");
}
public static void main(String[] args)
{
HelloBlackBerry app = new HelloBlackBerry();
app.enterEventDispatcher();
}
}
I do not have a Blackberry device to test on yet.
Normally, enabling the Mobile Data System Connection Service (aka MDS-CS) would have solved this BUT the MDS-CS version supplied with JRE 7.0.0 (9930 simulator) is incorrect! The original post on BlackBerry's forums can be found here.
According to this post:
An incorrect version of MDS-CS simulator was included in 7.0. To correct it you can delete it and copy the version from 6.0.
Deleting the invalid MDS version from JRE 7.0.0 and replacing it with the one from JRE 6.0.0 fixed the BrowserField issue for me. Don't forget to close and rerun the simulator and before reruning the application.
Here is a link to my original answer.
I too am having the same Problem and i came to know that as its the Runtime Exception so i suggest you to please write it in try catch block it seems it will work..
Thanks.
I want to suggest your one other thing that please rightclick on your project in eclipse and click on debug as... and in that click on debug configuration... and in that go into Simulator... and in that menu Select Launch Mobile Data System Connection Service with simulator... and there click on Apply and Debug it will work.
Thanks.
I got the Browser screen from your code; The thing is:
Before open the application some times you have to open the Blackberry browser and check any link(For Ex: http://google.com) even though you connect the internet settings and then run your application.
public class StartUp extends UiApplication
{
public static void main(String[]ali)
{
StartUp start=new StartUp();
start.enterEventDispatcher();
}
public StartUp()
{
MainScreen screen = new MainScreen();
BrowserField browserField = new BrowserField();;
screen.add(browserField);
pushScreen(screen);
browserField.requestContent("http://www.google.com/news");
}
}
This is a issue in blackberry please take a look into this
http://btsc.webapps.blackberry.com/btsc/microsites/search.do?cmd=displayKC&docType=kc&externalId=KB25846&sliceId=1&docTypeID=DT_SUPPORTISSUE_1_1&dialogID=1895604766&stateId=0%200%201895610037
Related
I'm currently experiencing this issue https://github.com/rnmapbox/maps/issues/2514
wherein inside my code mapbox component, if compassViewPosition is added, it terminates the app without even throwing an error. anyone else encountered something related to this (read, passed through or dreamt about); feel free to comment out. Happy to get enlightened here.
import React from 'react';
import MapboxGL from '#rnmapbox/maps';
class BugReportExample extends React.Component {
render() {
return (
<MapboxGL.MapView
compassViewPosition={3} // adding this line terminates the app (not tested in android yet, and no error from try catch)
/>
);
}
}
I'm in "react-native": "~0.66.5" and I'm using "#rnmapbox/maps": "rnmapbox/maps#main",
Previous package I'm using was "#react-native-mapbox-gl/maps": "^8.5.0" and it works fine here. I'm trying to upgrade to the newer package (I know it's not on stable release yet but wanna know if I'm the only one experiencing this).
I've been trying to get the example going for Naxam.Mapbox.iOS as described here: https://blogs.naxam.net/using-mapbox-in-xamarin-ios-ffa9bdee13f4
I'm using Visual Studio/Xamarin 8.6.5 on my MacBook Pro with MacOS Catalina 10.15.4. I added NuGet Packages Naxam.Mapbox.iOS 5.4.0 and Xamarin.Essentials 1.5.3.2 to my project. I created an account at Mapbox.com and an access token for me to use in the project which I added as the MGLAccountManager.AccessToken property to the Info.plist file. The project has been created using the iOS Single View App template. Finally I added the --registrar:static argument to the Additional mtouch arguments in my iOS Build.
I added the first snippet of the blog post to my project as follows:
namespace MapboxSingleView
{
public partial class ViewController : UIViewController
{
public ViewController(IntPtr handle) : base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
var map = new MGLMapView(View.Bounds, new NSUrl("mapbox://styles/naxamtest/cj5kin5x21li42soxdx3mb1yt"));
View.AddSubview(map);
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
}
}
}
Trying to run this in my simulator using Debug -> iPhone 11 iOS 13.5 shows a blank/white page with just the Mapbox logo in the bottom left corner but no actual map being displayed at all.
Trying without the NSUrl or adding the map's center & zoom level snippet as described doesn't help either. I tried contacting Naxam, but so far haven't received any response from them.
What did I miss?
The fact you can see the Mapbox logo indicates that you have done the installation correctly. The blank white page is usually down to a problem with the access token. You say you added
MGLAccountManager.AccessToken
to your info.plist file. The gif in the link on the tutorial page shows that if you are adding the entry in the info.plist file, then you should just add:
MGLAccountManager (with a value of <Your Mapbox access token>)
to that file. If you wish, instead, to add the access code in your code, then use:
MGLAccountManager.AccessToken = "<Your Mapbox access token>"
So it changes depending on if you want to enter your code in the info.plist file or as a line in your own code.
I am trying to implement Realm on a smaller Xamarin/Mvvmcross/iOS/Droid project in order to test it's ability to replace SQLite.
I have it working well on the iOS project but am getting exceptions on the Droid project when attempting to call Realm.GetInstance();
The Type initializer for 'Realms.Realm' threw an exception
Inner Exception
System.Reflection.ReflectionTypeLoadException
The classes in the module cannot be loaded.
I have narrowed it what I believe is an issue with reflection if the MvvmCross setup occurs before the Realm dll is loaded.
For example if I call Realm.GetInstance() in any activity that inherits from MvxActivity or MvxAppCompatActivity (or anywhere in the Mvvmcross Setup / CreateApp process) the exception occurs.
If however I call var db = Realm.GetInstance() (& db.Close()) from a normal Droid Activity first, and then start the Mvx Setup process, by starting an MvxActivity, from the Droid Activity it works fine, and continues to work through the application lifecycle.
Likewise if I subclass Application and open a Realm instance in OnCreate() and close it Real will initialise anywhere else in the application.
sample code
//works
[Application]
public class CustomApplication : Application
{
public CustomApplication (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer)
{
}
public override void OnCreate ()
{
base.OnCreate ();
var db = Realm.GetInstance ();
db.Close ();
}
}
//does not work unless Realm.GetInstance() has already been called once
[Activity(Label = "View for FirstViewModel")]
public class FirstView : MvxActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.FirstView);
var db = Realm.GetInstance ();
db.Close ();
}
}
I've put a test project on github at https://github.com/vurtigo/TestRealm
This is an unfortunate mix-up between Realm and Xamarin Android.
The static constructor on the Realm class walks through all the assemblies in the current AppDomain to discover all the types that inherit from RealmObject. However, if at the time Xamarin Android builds Java binding code this will define a new System.Reflection.Emit.AssemblyBuilder assembly that will raise a TypeLoadException when its types are enumerated (see Bug 39679 - ReflectionTypeLoadException after some reflection stuff).
The workaround is to cause the Realm static constructor to be invoked before any of the MvvmCross code causes Xamarin Android to emit binding code. You can do that by accessing any of the static members on Realm such as ReferenceEquals or even by including it in a typeof(Realm) expression. I suppose MvxApplication.Initialize() is a good place to do it.
In any case, I have proposed a fix that will ignore AssemblyBuilder instances in general. The very next Realm release should include it and you'll be able to delete the workaround code as soon as you upgrade.
I'm getting started with PhoneGap on iOS and not having much luck. My app is stuck on the splash screen and nothing is shown in Phoegap Build's console.
The screenshot at http://i.imgur.com/Ru9n3ET.png shows both my file structure and skeleton code. The only thing I see from the app is the alert of '1' called from body's onload event. Nothing else is shown. Is there a glaring mistake which is killing the app?
alert(1) is coming from javaScript and you has nothing to do with phonegap.
You would want to make sure that your code directory has the necessary API's that call Phonegap code. It would look like something below:
package com.news.newsfinder;
import org.apache.cordova.DroidGap;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends DroidGap {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
You must have cordova.jar in your build path and cordova.js in your js directory.
Then your javascript code to call phonegap API's can become something like this.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
checkConnection();
}
function checkConnection() {
//code to check what type of internet connection a device is using, wifi, 2G, 3G...
}
The above code which has a package com.news.newsfinder will make an APP in play store like below:
http://play.google.com/store/apps/details?id=com.news.newsfinder
This--
import net.rim.device.api.ui.container.VerticalFieldManager;
public class FixedHeightVerticalFieldManager extends VerticalFieldManager
{
private int height;
public FixedHeightVerticalFieldManager(int height)
{
super();
this.height = height;
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(maxWidth, height);
setExtent(height);
}
}
--causes the emulator to hang with the runtime exception net.rim.device.api.ui.ScrollView not found. It seems to be caused by the call to setExtent, which is a method VerticalFieldManager inherited from Field, which is in the 4.6 API that the emulator is set up to use. Why? What does ScrollView have to do with anything?
net.rim.device.api.ui.ScrollView is not available in 4.6 API - that's the reason. So I suspect you're using the ScrollView somewhere in your code while you are trying to run on a 4.6 OS simulator.
Also what API version is used to build the project? Normally (if you'd use 4.6 API lib/JDE) you should have got this error at building step (versus in runtime).
UPDATE:
I really have no idea why this is related to setExtent().
I suspect most likely you compile using API 6. For API 6 the inheritance chain looks as Field > ScrollView > Manager > VerticalFieldManager, so when you compile a VerticalFieldManager it may use ScrollView. Maybe that's why you get the error on API 4.6 simulator. You can test this idea by trying to run your app on any OS 6.0 simulator. I believe it should not give this error.
P.S. I have not used BB Eclipse plugin much (once I tried, but then refused because of some issues), so I can't say where exactly to check the API version. However surely there must be a way to check that.