Java中的方法修饰符(Method modifiers in Java)
我正在编写代码以匹配给定字符串或行的方法声明。 这是我的问题出现的地方。 当试图匹配修饰符时,我在声明时感到难过
public static
工作。 我一直都这样做
static public
所以这是我的问题。 两者之间有什么区别,对于所有修饰符都是一样的。 我确信有一个原因,而且松散的顺序不是一个设计决定。
哦,如果有人知道匹配给定字符串的方法的最佳方法,请告诉我。 谢谢。 现在我正在使用正则表达式。
I am writing code to match a method declaration given a string, or line. This is where my question came up. When trying to match the modifiers, I got stumped when the declaration
public static
worked. I have always done
static public
So here is my question. What is the difference between the two and is it the same for all modifiers. I'm sure there is a reason, and that the loose ordering is not a design decision.
Oh, and if one knows the best method for matching a method given a string, please tell me. Thanks. Right now I'm using regular expressions.
原文:https://stackoverflow.com/questions/28523415
最满意答案
如果您使用的是listview,请尝试执行mListView.invalidateViews()。 如果您使用listActivity,只需调用mList.invalidateViews()。
If you are using listview, try to do mListView.invalidateViews(). If you are using listActivity, just call mList.invalidateViews().
相关问答
更多-
主页按钮: =>您无法重写主页按钮的行为。 后退按钮: =>为了捕获或覆盖Android中的默认后退按钮,以下onKeyDown方法可由Activity执行。 @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { moveTaskToBack(true); return true ...
-
如果使用location.hash而不是location.href则不应发生您指定的行为。 HTML5标准指定了新的历史记录功能,例如history.pushState() ,它为此提供了一个很好的替代品,但并非所有浏览器都支持它。 如果您不想推出自己的框架,那么有许多提供此功能的javascript插件都可以很好地打包,以便在具有稍微不同实现的浏览器中轻松使用。 例如, jquery历史记录将在支持它的浏览器上使用较新的history选项,并在不支持它的浏览器中回退到哈希URL。 if you use l ...
-
(注:根据Sharky的反馈,我已经包含了检测后台空间的代码) 所以,我经常在SO上看到这些问题,最近遇到了自己控制后退按钮功能的问题。 经过几天的搜索,我的应用程序(单页哈夫导航)的最佳解决方案,我已经提出了一个简单的,跨浏览器的无库系统来检测后退按钮。 大多数人建议使用: window.onhashchange = function() { //blah blah blah } 但是,当用户使用更改位置哈希的页内元素时,也会调用此函数。 当用户点击并且页面向后或向后移动时,不是最好的用户体验。 为了 ...
-
使用javascript触发浏览器/ android中的后退按钮上的事件(Trigger an event on back button in browser/android with javascript)[2021-10-21]
我放弃了试图检测用户按下后退按钮并对其进行操作。 相反,将其设为默认操作并更改按钮的行为方式。 我检测用户何时按下其中一个按钮并根据它设置变量。 var navigating = false; $scope.$on('$locationChangeStart', function(event) { if($scope.global.application="new-ad" && !navigating){ event.preventDefault() ... -
是否有可能在Web浏览器中模拟Android“硬件”后退按钮?(Is it possible to simulate Android “hardware” back-button in web browser?)[2023-07-22]
我有一个工作解决方案,我想与你分享。 当按下Alt+Ctrl+<它会触发backbutton事件。 当然,像navigator.app.exitApp()这样的东西不起作用,但简单的导航工作,例如关闭模态。 AppModule.run(function ($window, $document, $ionicPlatform) { 'use strict'; var document = $document[0]; function triggerBackButton() { ... -
如果你只是添加一个可见度为GONE的按钮,那就好了。 如果你想显示后退按钮,只有让它隐藏在顶部才会显示在顶部? 为什么只有一个按钮的单独列表视图? WOuldn't it be better if you just add a button with the visibility GONE. And only make it visible on the top if you want to show the back button else just leave it hidden? Why a sepe ...
-
Cordova Inapp浏览器在Android后退按钮上重新打开?(Cordova Inapp browser reopens on android back button?)[2022-04-28]
确保你正在处理backbutton cordova 事件 。 而不是退出应用程序,为什么不禁用导航回到该页面。 在后退按钮事件上检查您要去的路线以及该页面是否禁用它。 Make sure you're handling the backbutton cordova event. Instead of exiting the app, why not just disable navigation back to that page. On back button event check the route ... -
你在onKeyDown中得到NullPointerException吗? 那是因为您没有将WebView分配给实例变量: webview = (WebView) findViewById(R.id.webView1); 后面的功能可以像这样实现: public void onBackPressed() { if (webview.canGoBack()) webview.goBack(); else super.onBackPressed(); } Are ...
-
JavaScript可以钩住并覆盖浏览器的后退和前进按钮吗?(Can JavaScript hook and override browser back and forward buttons?)[2024-02-09]
使用Ben Alman出色的jQuery-bbq插件: http ://benalman.com/projects/jquery-bbq-plugin/它提供了一个与后退/前进按钮一起使用的hashchange跨浏览器。 Use Ben Alman's great jQuery-bbq plugin: http://benalman.com/projects/jquery-bbq-plugin/ which provides a hashchange cross-browser that is used i ... -
如果您使用的是listview,请尝试执行mListView.invalidateViews()。 如果您使用listActivity,只需调用mList.invalidateViews()。 If you are using listview, try to do mListView.invalidateViews(). If you are using listActivity, just call mList.invalidateViews().