com.codename1.io.Log Java Examples
The following examples show how to use
com.codename1.io.Log.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LandscapeToolbarHiddenSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if (err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #2
Source File: SocketSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #3
Source File: DraggableTabsSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if (err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #4
Source File: TextSelectionSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #5
Source File: BadgesSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #6
Source File: TabsAnimationSample2957.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if (err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #7
Source File: TextFieldHintStylingTest.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #8
Source File: SideMenuBar.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Creates the Side Menu open button. * @return a Button instance to place on the TitleArea */ protected Button createOpenButton(){ Button ob = new Button(); ob.setUIID("MenuButton"); UIManager uim = parent.getUIManager(); Image i = (Image) uim.getThemeImageConstant("sideMenuImage"); if (i != null) { ob.setIcon(i); } else { float size = 4.5f; try { size = Float.parseFloat(uim.getThemeConstant("menuImageSize", "4.5")); } catch(Throwable t) { Log.e(t); } FontImage.setMaterialIcon(ob, FontImage.MATERIAL_MENU, size); } Image p = (Image) uim.getThemeImageConstant("sideMenuPressImage"); if (p != null) { ob.setPressedIcon(p); } return ob; }
Example #9
Source File: GradientTest.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #10
Source File: SwitchListSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #11
Source File: ButtonLongPointerPress.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #12
Source File: SetBrowserURLWithJarUrlSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #13
Source File: AsyncResourceSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #14
Source File: IOS13RegressionTest.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #15
Source File: InfiniteContainerSafeAreaTest.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if (err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #16
Source File: InterFormContainerSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if (err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #17
Source File: AsyncStackTracesTest.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #18
Source File: Purchase.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Gets all of the receipts for this app. Note: You should periodically * reload the receipts from the server to make sure that the user * hasn't canceled a receipt or renewed one. * @return List of receipts for purchases this app. */ public final List<Receipt> getReceipts() { synchronized (RECEIPTS_KEY) { if (receipts == null) { if (Storage.getInstance().exists(RECEIPTS_KEY)) { Receipt.registerExternalizable(); try { receipts = (List<Receipt>)Storage.getInstance().readObject(RECEIPTS_KEY); } catch (Exception ex) { Log.p("Failed to load receipts from "+RECEIPTS_KEY); Log.e(ex); receipts = new ArrayList<Receipt>(); } } else { receipts = new ArrayList<Receipt>(); } } return receipts; } }
Example #19
Source File: AutoCapitalizationTest.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #20
Source File: FacebookConnect.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Gets the FacebookConnect singleton instance * . * @return the FacebookConnect instance */ public static FacebookConnect getInstance() { if (instance == null) { if (implClass != null) { try { instance = (FacebookConnect) implClass.newInstance(); } catch (Throwable t) { Log.e(t); instance = new FacebookConnect(); } } else { instance = new FacebookConnect(); } } return instance; }
Example #21
Source File: FlowLayoutRTLTest.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); UIManager.getInstance().getLookAndFeel().setRTL(true); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #22
Source File: JavascriptContext.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Executes a Javascript string and returns the string. It is synchronized * to disallow multiple threads from running javascript on the same BrowserComponent. * * <p>This is just a thin wrapper around the BrowserComponent.executeAndReturnString() method.</p> * * @param js * @return The string result of executing the Javascript string. */ private String exec(String js, boolean async){ synchronized (browser) { if ( DEBUG ){ Log.p("About to execute("+async+") "+js); //browser.execute("console.log(execute ca_weblite_codename1_js_JavascriptContext_LOOKUP_TABLE0[0])"); } if (async) { browser.execute(installCode()+";("+js+")"); return null; } else { return browser.executeAndReturnString(installCode()+";("+js+")"); } } }
Example #23
Source File: CSSMediaQueriesSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #24
Source File: AnalyticsService.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
private static ConnectionRequest GetGARequest() { ConnectionRequest req = new ConnectionRequest(); req.setUrl("https://www.google-analytics.com/collect"); req.setPost(true); req.setFailSilently(true); req.addArgument("v", "1"); req.addArgument("tid", instance.agent); if (timeout > 0) { req.setTimeout(timeout); } if (readTimeout > 0) { req.setReadTimeout(readTimeout); } long uniqueId = Log.getUniqueDeviceId(); req.addArgument("cid", String.valueOf(uniqueId)); return req; }
Example #25
Source File: MediaPlayer.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Convenience JavaBean method, see other version of this method * @param uri the URL for the media */ public void setDataSource(final String uri) { if(!isInitialized()) { pendingDataURI = uri; return; } if(dataSource == null || !dataSource.equals(uri)) { Display.getInstance().startThread(new Runnable() { public void run() { try { setDataSource(uri, null); } catch(Throwable t) { Log.e(t); } } }, "Media Thread").start(); } }
Example #26
Source File: PickerTest3071.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #27
Source File: AudioRecorderComponentSample.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }
Example #28
Source File: DatabaseTests.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
private void testSimpleQueriesInCustomPath() throws Exception { if (Database.isCustomPathSupported()) { String dbName = new File("somedir/testdb").getAbsolutePath(); new File(dbName).getParentFile().mkdirs(); Database.delete(dbName); Database db = Database.openOrCreate(dbName); db.execute("create table tests (name text)"); db.execute("insert into tests values ('Steve'), ('Mike'), ('Ryan')"); Cursor c = db.executeQuery("select count(*) from tests"); c.next(); this.assertEqual(3, c.getRow().getInteger(0), "Expected result of 3 for count(*) after inserting 3 rows"); } else { Log.p("testSimpleQueriesInCustomPath skipped on this platform"); } }
Example #29
Source File: PropertyIndex.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * Loads JSON containing a list of property objects of this type * @param name the name of the storage * @return list of property objects matching this type */ public <X extends PropertyBusinessObject> List<X> loadJSONList(String name) { try { InputStream is = Storage.getInstance().createInputStream(name); JSONParser jp = new JSONParser(); JSONParser.setUseBoolean(true); JSONParser.setUseLongs(true); List<X> response = new ArrayList<X>(); Map<String, Object> result = jp.parseJSON(new InputStreamReader(is, "UTF-8")); List<Map> entries = (List<Map>)result.get("root"); for(Map m : entries) { X pb = (X)newInstance(); pb.getPropertyIndex().populateFromMap(m, parent.getClass()); response.add(pb); } return response; } catch(IOException err) { Log.e(err); throw new RuntimeException(err.toString()); } }
Example #30
Source File: SpanLabelTestAllStyles2891.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); }