菜鸟求解:A转账给B java参数引用传递 int为int coument, A B 余额不能小于0 Java实现

JabRef / Bugs / #1103 Could not find a Java Runtime Environment" but there is one
JabRef is a graphical application for managing bibliographical data
Brought to you by:
#1103 Could not find a Java Runtime Environment" but there is one
Milestone:
I am using Windows 8 x64, with the following java version :
-----------------
C:\Users\Erwan&java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
-----------------
I've just downloaded and installed JabRef 2.8.1. When launching JabRef.exe, I have the following complaint that pops:
-----------------
Could not find a Java Runtime Environment installed on your computer.
Without it you cannot run "JabRef".
Would you like to visit the Java website to download it?
-----------------
However, If I directly use JabRef-2.8.1.jar, this complaint does not appear and Jabref works perfectly fine.
Thanks for your work on jabref ! :)
Discussion
Windows 7 x64 I have exactly the same problem
-Same error message
-Same java version
It also happened wiht jabref 2.7.2&
Last edit: Anonymous
You seem to have CSS turned off.
Please don't fill out this field.
You seem to have CSS turned off.
Please don't fill out this field.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Setting JAVA_HOME environment to java installation directory (e.g. C:\Program Files (x86)\Java\jre7) resolved at my place (Windows 8, 64 bit).
An environment variable can be added/modified from Control Panel -& System and Security -& System -& Advanced System Setting -& Advanced Setting tab -& Environment Variables button.&
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think this should be documented somewhere on the download page.&
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This bug is duplicate to bug 1100. Attached another launcher for JabRef-2.9.jar. Please test it.&
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, it worked fine without setting JAVA_HOME. Thanks!&
Last edit: Koji
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Confirmed, the replacement .exe works fine.&
Last edit: Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I updated the installer to contain the updated launcher. Please try out a development built: &
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
assigned_to: Oliver Kopp
milestone:
--& Targetted_for_next_release
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
status: open --& closed
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
to post a comment.java - org.hibernate.hql.ast.QuerySyntaxException with Hibernate - Stack Overflow
Join Stack Overflow to learn, share knowledge, and build your career.
or sign in with
I'm new to using Hibernate with Java. I'm getting the following exception. The stuff that I found online regarding this error didn't seem to help. Any ideas?
The Exception:
java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException:
ApplPerfStats is not mapped [select count(c) from ApplPerfStats c]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:601)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)
at com.icesoft.icefaces.samples.datatable.jpa.CustomerDAO.findTotalNumberCustomers(CustomerDAO.java:89)
at com.icesoft.icefaces.samples.datatable.ui.SessionBean.getDataPage(SessionBean.java:189)
at com.icesoft.icefaces.samples.datatable.ui.SessionBean.access$0(SessionBean.java:185)
at com.icesoft.icefaces.samples.datatable.ui.SessionBean$LocalDataModel.fetchPage(SessionBean.java:245)
at com.icesoft.icefaces.samples.datatable.ui.PagedListDataModel.getPage(PagedListDataModel.java:121)
at com.icesoft.icefaces.samples.datatable.ui.PagedListDataModel.getRowCount(PagedListDataModel.java:100)
at com.icesoft.faces.component.datapaginator.DataPaginator.isModelResultSet(DataPaginator.java:1091)
at com.icesoft.faces.component.datapaginator.DataPaginatorRenderer.encodeBegin(DataPaginatorRenderer.java:201)
The place where this is called:
@SuppressWarnings("unchecked")
public Long findTotalNumberCustomers() {
EntityManagerHelper.log("finding number of Customer instances", Level.INFO, null);
String queryString = "select count(c) from ApplPerfStats c";
return (Long) getEntityManager().createQuery(queryString).getSingleResult();
} catch (RuntimeException re) {
EntityManagerHelper.log("find number of Appl_perf_stats failed",
Level.SEVERE, re);
The class that maps to the database table:
package com.icesoft.icefaces.samples.datatable.
import java.sql.T
import javax.persistence.C
import javax.persistence.E
import javax.persistence.Id;
import javax.persistence.T
@Table(name = "Appl_perf_stats", uniqueConstraints = {})
public class ApplPerfStats implements java.io.Serializable {
27.7k1794148
5,4431858112
Try adding a class element under persistence-unit, in your persistence.xml file.
&?xml version="1.0" encoding="UTF-8"?&
&persistence ...&
&persistence-unit name="unit"&
&class&com.icesoft.icefaces.samples.datatable.jpa.ApplPerfStats&/class&
&/persistence-unit&
&persistence&
I haven't done much more than that with JPA/EntityManager, so I don't know if there's a way to add an entire package. AFAIK, when using hibernate.cfg.xml, each persistent class has to be specified directly.
8,20712125
It happened to me until I started to use the full class name, e.g.:
String queryString = "select count(c) from com.my.classes.package.ApplPerfStats c";
But I don't like this approach, because it's refactoring-unfirendly. A more tractable one would be:
String queryString = "select count(c) from " + ApplPerfStats.class.getName() +
javashlook's solution seems to be a shortcut for that - but it adds more XML configuration, which I try to avoid. If only there was an annotation-based way to specify that...
1,88332325
I was having the same problem and I solved by adding aspectj entries to my pom.xml see below. I guess it makes sense if you are using annotations. Otherwise you need to specify the mappings in the XML file. I had this problem from a project that was using a jar with JPA annotations.
&groupId&org.codehaus.mojo&/groupId&
&artifactId&aspectj-maven-plugin&/artifactId&
&version&1.2&/version& &!-- NB: do use 1.3 or 1.3.x due to MASPECTJ-90 - wait for 1.4 --&
&dependencies&
&!-- NB: You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) --&
&dependency&
&groupId&org.aspectj&/groupId&
&artifactId&aspectjrt&/artifactId&
&version&${aspectj.version}&/version&
&/dependency&
&dependency&
&groupId&org.aspectj&/groupId&
&artifactId&aspectjtools&/artifactId&
&version&${aspectj.version}&/version&
&/dependency&
&/dependencies&
&executions&
&execution&
&configuration&
&weaveDependencies&
&weaveDependency&
&groupId&your.project&/groupId&
&artifactId&your.artifact&/artifactId&
&/weaveDependency&
&/weaveDependencies&
&/configuration&
&goal&compile&/goal&
&goal&test-compile&/goal&
&/execution&
&/executions&
&configuration&
&outxml&true&/outxml&
&aspectLibraries&
&aspectLibrary&
&groupId&org.springframework&/groupId&
&artifactId&spring-aspects&/artifactId&
&/aspectLibrary&
&/aspectLibraries&
&source&1.6&/source&
&target&1.6&/target&
&/configuration&
You should specify a column to do the count on
select count(c.someColumn) from ApplPerfStats c
Or try a count(*)
select count(*) from ApplPerfStats c
8,557104058
I faced this issue but in my case the problem was due to gradle version.
When I changed my system from linux to mac then I had to switch from gradle-1.0-milestone-3 to gradle-1.0-milestone-4 as milestone-3 does not work in OSX. And in gradle-1.0-milestone-4 I faced the same issue then I had to degrade my gradle version to gradle-1.0-milestone-1. Now it is working fine
I was also face this problem fixed by this ...
You haven't declared your entity classes in persistence.xml config file:
&property name="hibernate.archive.autodetection" value="class, hbm"/&
2,39811431
I know it has been a long time on this matter, but none of the above answers solved my problem.
I had already declared the entity in the persistence.xml file.
At the end the whole problem was simply that the name of the entity is case sensitive on my system.
This jpql was wrong
SELECT u FROM user u WHERE userId = 1?
But this one works fine
SELECT u FROM User u WHERE userId = 1?
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Upcoming Events
ends Mar 27
Stack Overflow works best with JavaScript enabledJava: No JVM could be found on your system HELP!?PLZ!?
IT says No JVM could be found on your system. please define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE or download a JRE from www.java.com.
Im trying to open minecraft when it happens and I DID install java 64 bit and its obviously saying i didnt.... I DO have a 64 bit system trying to get 64...
IT says No JVM could be found on your system. please define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE or download a JRE from www.java.com.
Im trying to open minecraft when it happens and I DID install java 64 bit and its obviously saying i didnt.... I DO have a 64 bit system trying to get 64 bit java to work for minecraft plz tell me what i have to do if it works i'll give u best answer :D
4 following
Report Abuse
Are you sure you want to delete this answer?
Sorry, something has gone wrong.
Trending Now
Best Answer:&
Start & Computer & Local Disk (C:/) & Program Files & Java & jre6 & bin
Copy the filepath (asuming your partition is the default, C:/, it would the following):
C:\Program Files\Java\jre6\bin
Next, Start & Right-click on
My computer & Properties & Advanced system settings & Enviroment Variables & look for &Path& in the lower box & Highlight &path& and click &edit& & Put a semi-colon ( ; ) at the end of the text and paste the filepath you copied earlier right after the semi-colon.
Now, restart your computer and try opening the Java application again.
If you need more help, email me at:
Source(s):
Thumbs down
Report Abuse
& just now
Asker's rating
IT says No JVM could be found on your system. please define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE or download a JRE from www.java.com.
I have done exactly as you indicated above and still i can't print my coupons. it says to install java which i do but that does not help. I believe i initially must have erased java because all i have in the list of programs Java 7 update (64 bit) listed? I am running vista operating system 64 bit and using Internet Explorer 8 it also does not work in Google Chrome also gives the same error. Please help me.
Thumbs down
Report Abuse
& just now
This Site Might Help You.
Java: No JVM could be found on your system HELP!?PLZ!?
IT says No JVM could be found on your system. please define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE or download a JRE from www.java.com.
Im trying to open minecraft when it happens and I DID install java 64 bit and its obviously saying i didnt.... I DO have a 64 bit system...
Source(s):
java jvm system plz: https://biturl.im/0hgxP
Thumbs down
Report Abuse
& just now
Why can't the company that caused this problem in the first place fix it?
Is it Java?
Four years is a long time for the same issue to be recurring.
Thumbs down
Report Abuse
& just now
Tom's answer from 3 years ago is correct with just 2 minor errors, but very important for this to work. On the whole path change the forward slashes (/) to backward slashes (\). 2nd make sure that your path of java has a version number at the end of it because that must be typed into the &PATH& as well. So meaning when you go to.......Start & Right-click on My computer & Properties & Advanced system settings & Enviroment Variables & look for &Path& in the lower box & Highlight &path& and click &edit& & Put a semi-colon ( ; ) at the end of the text and paste the filepath you copied earlier right after the semi-colon.......make sure your path is correct with backward slashes and the version number.
Mine looked like this.......c:\Program Files\java\jre1.8.0_25\bin.......that is what i put in the &PATH& after the added semi colin (;).....DO NOT ERASE WHAT IS ALREADY THERE!!!!!......ADD THE SEMI COLIN THEN YOUR PATH.
This worked for me, the source of my error i know came from SAMSUNG LINK, I am running Windows 8.1 on a High End PC Rig.
https://s.yimg.com/tr/i/43d1b75dd8fdccf634aa10_A.png
Thumbs down
Report Abuse
& just now
that program is not free it is $29.99 like all the million others that don't work they are all rip offs. This is a Java problem and they need to fix it no one else can?
Thumbs down
Report Abuse
& just now
Java SDK (64 Bit) Das Java Software Development Kit (JDK) um fast die ... Java: No JVM could be found on your system HELP!? PLZ!?
Thumbs down
Report Abuse
& just now
Install jdk version 7... it's only compatible with 7 not with 8...
Thumbs down
Report Abuse
& just now
Codecollab
Source(s):
Thumbs down
Report Abuse
& just now
In addition to the error above, I had a message that the JRE was damaged. I downloaded the stand alone at http://download.cnet.com/Java-Runtime-Environment-JRE-64-Bit/-.html?tag=pdl-redir, and it solved my issue.
Thumbs down
Report Abuse
& just now
Report Abuse
I think this question violates the Community Guidelines
Chat or rant, adult content, spam, insulting other members,
I think this question violates the Terms of Service
Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing,
Additional Details
If you believe your intellectual property has been infringed and would like to file a complaint, please see our
Report Abuse
Report Abuse
I think this answer violates the Community Guidelines
Chat or rant, adult content, spam, insulting other members,
I think this answer violates the Terms of Service
Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing,
Additional Details
If you believe your intellectual property has been infringed and would like to file a complaint, please see our
Report Abuse
Report Abuse
I think this comment violates the Community Guidelines
Chat or rant, adult content, spam, insulting other members,
I think this comment violates the Terms of Service
Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing,
Additional Details
If you believe your intellectual property has been infringed and would like to file a complaint, please see our
Report Abuse
Maybe you would like to learn more about one of these?
Ask a question
usually answered in minutes!
Existing questions
Tell us some more
Upload in Progress
Upload failed. Please upload a file larger than 100x100 pixels
We are experiencing some problems, please try again.
You can only upload files of type PNG, JPG, or JPEG.
You can only upload files of type 3GP, 3GPP, MP4, MOV, AVI, MPG, MPEG, or RM.
You can only upload photos smaller than 5 MB.
You can only upload videos smaller than 600MB.
You can only upload a photo (png, jpg, jpeg) or a video (3gp, 3gpp, mp4, mov, avi, mpg, mpeg, rm).
You can only upload a photo or a video.
Video should be smaller than &b&600mb/5 minutes&/b&
Photo should be smaller than &b&5mb&/b&
Video should be smaller than &b&600mb/5 minutes&/b&Photo should be smaller than &b&5mb&/b&
Related Questions
More questions
Answer Questions
19 answers
More questionsFragment in Android: Tutorial with Example using WebView
Fragment in Android: Tutorial with Example using WebView Fragment in Android: Tutorial with Example using WebView In this post we want to explain how to use fragment in Android with a real example. In this post we want to go deeper and create an example that helps us to understand better how we can use fragments. The post will describe how to use Framelayout and how to exchange data between fragments. The last post introduced the main concepts about
and how we can use it to support multiple screen. We described their lifecycle and how we can use it.As example how to use fragment in Android, we want to create a simple application that is built by two fragments:one that shows a list of links andanother one that shows the web page in a WebView.We can suppose we have two different layouts one for portrait mode and one for landscape. In the landscape mode we want something like the image below:
while, in the portrait mode we want something like:
CREATE Android UI LAYOUTThe first step we have to do is creating our layout. As we said we need two different layout one for portrait and one for landscape. So we have to create two xml file under res/layout (for portrait mode) and one under res/layout-land (for landscape mode). Of course we could customize more our layout including other specs but it is enough for now. These two files are called activity_layout.xml.&RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" &
&fragment android:id="@+id/listFragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.survivingwithandroid.fragment.LinkListFragment"/&
&/RelativeLayout&This one is for the portrait mode and as we notice we have only one fragment containing just the link list. We will see later how to create this fragment. We need, moreover, another layout as it is clear from the pic above, the one that contains the WebView.&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" &
&WebView android:id="@+id/webPage"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/&
&/LinearLayout&
For the landscape mode we have something very similar plus the FrameLayout component in the same layout.&LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="horizontal" &
&fragment android:id="@+id/listFragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
class="com.survivingwithandroid.fragment.LinkListFragment"
android:layout_weight="2"/&
&FrameLayout android:id="@+id/fragPage"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
&/LinearLayout&Create link list fragmentAs you have already noticed both layout have a common fragment that is called LinkListFragment. We have to create it. If you didn’t read already the post explaining the lifecycle it is time you give a look. In this case we don’t have to override all the methods in the fragment lifecycle, but those important to control its behaviour. In our case we need to override:onCreateViewonAttachIn this fragment we use a simple ListView to show the links and a simple adapter to customize the way how the items are shown. We don’t want to spend much time on how to create a custom adapter because it is out of this topic you can refer
to have more information. Just to remember in the onCreateView fragment method we simply inflate the layout and initialize the custom adapter. As XML layout to inflate in the fragment we have:&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" &
&ListView android:id="@+id/urls"
android:layout_height="match_parent"
android:layout_width="wrap_content"/&
&/LinearLayout&while in the method looks like:@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d("SwA", "LV onCreateView");
View v = inflater.inflate(R.layout.linklist_layout, container, false);
ListView lv = (ListView) v.findViewById(R.id.urls);
la = new LinkAdapter(linkDataList, getActivity());
lv.setAdapter(la);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView&?& parentAdapter, View view, int position,
long id) {
LinkData data = ( (LinkAdapter) la ).getItem(position);
( (ChangeLinkListener) getActivity()).onLinkChange(data.getLink());
}In this method we simply set our custom adapter and the set the listener when the user clicks on an item. We will cover this later (if you are curious see Inter fragment communication).In the onAttach method we verify that the activity that holds the fragment implements a specific interface.@Override
public void onAttach(Activity activity) {
// We verify that our activity implements the listener
if (! (activity instanceof ChangeLinkListener) )
throw new ClassCastException();
super.onAttach(activity);
}We will clarify why we need this control later.Fragment in Android: COMMUNICATIONBasically in our example we have two fragments and they need to exchange information so that when user select an item in the fragment 1 (LinkListFragment) the other one (WebViewFragment) shows the web page corresponding to the link. So we need to find a way to let these fragments to exchange data. On the other way we know that a fragment in Android is a piece of code that can be re-used inside other activity so we don’t want to bind our fragment to a specific activity to not invalidate our work. In Java if we want to decouple two classes we can use an interface. So this interface solution fits perfectly. On the other hand we don’t want that our fragment exchange information directly because each fragment can rely only on the activity that holds it. So the simplest solution is that the activity implements an interface.So in our case we define an interface called ChangeLinkListener that has only one method:public interface ChangeLinkListener {
public void onLinkChange(String link);
}We have, more over, to verify that our activity implements this interface to be sure we can call it. The best place to verify it is in the onAttach method (see above) and at the end we need to call this method when the user selects an item in the ListView:lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView&?& parentAdapter, View view, int position,
long id) {
LinkData data = ( (LinkAdapter) la ).getItem(position);
(ChangeLinkListener) getActivity()).onLinkChange(data.getLink());
});Programming main activity: Find fragmentBy now we talked about fragment in Android only, but we know that fragments exists inside a “father” activity that control them. So we have to create this activity but we have to do much more. As we said before this activity has to implements a custom interface so that it can receive data from the LinkListFragment. In this method (onLinkChange) we have somehow to control if we are in landscape mode or in portrait mode, because in the first case we need to update the WebViewFragment while in the second case we have to start another activity. How can we do it? The difference in the layout is the presence of the FrameLayout. If it is present it means we are in landscape mode otherwise in portrait mode. So the code in the onLinkChange method is:@Override
public void onLinkChange(String link) {
System.out.println("Listener");
// Here we detect if there's dual fragment
if (findViewById(R.id.fragPage) != null) {
WebViewFragment wvf = (WebViewFragment)
getFragmentManager().findFragmentById(R.id.fragPage);
if (wvf == null) {
System.out.println("Dual fragment - 1");
wvf = new WebViewFragment();
wvf.init(link);
// We are in dual fragment (Tablet and so on)
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
//wvf.updateUrl(link);
ft.replace(R.id.fragPage, wvf);
ft.commit();
Log.d("SwA", "Dual Fragment update");
wvf.updateUrl(link);
System.out.println("Start Activity");
Intent i = new Intent(this, WebViewActivity.class);
i.putExtra("link", link);
startActivity(i);
}Let’s analyse this method. The first part (line 5) verify that exists the FrameLayout. If it exists we use the FragmentManager to find the fragment relative to the WebViewFragment.
If this fragment is null (so it is the first time we use it) we simply create it and put this fragment “inside” the FrameLayout (line 7-20). If this fragment already exists we simply update the url (line 23). If we aren’t in landscape mode, we can start a new activity passing data as an Intent (line 28-30).WEBVIEW FRAGMENT AND WEBVIEWACTIVITY: The web pageFinally we analyze the WebViewFragment. It is really simple, it is just override some Fragment method to customize its behaviour:public class WebViewFragment extends Fragment {
private String currentURL;
public void init(String url) {
currentURL =
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d("SwA", "WVF onCreateView");
View v = inflater.inflate(R.layout.web_layout, container, false);
if (currentURL != null) {
Log.d("SwA", "Current URL 1["+currentURL+"]");
WebView wv = (WebView) v.findViewById(R.id.webPage);
wv.getSettings().setJavaScriptEnabled(true);
wv.setWebViewClient(new SwAWebClient());
wv.loadUrl(currentURL);
public void updateUrl(String url) {
Log.d("SwA", "Update URL ["+url+"] - View ["+getView()+"]");
currentURL =
WebView wv = (WebView) getView().findViewById(R.id.webPage);
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl(url);
private class SwAWebClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
In the onCreateView method we simply inflate our layout inside the fragment and verify that the url to show is not null. If so we simply show the page (line 15-30). In the updateUrl we simply find the WebView component and update its url.
In the portrait mode we said we need to start another activity to show the webpage, so we need an activity (WebViewActivity). It is really simple and i just show the code without any other comment on it:
public class WebViewActivity extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebViewFragment wvf = new WebViewFragment();
Intent i = this.getIntent();
String link = i.getExtras().getString("link");
Log.d("SwA", "URL ["+link+"]");
wvf.init(link);
getFragmentManager().beginTransaction()
.add(android.R.id.content, wvf).commit();
}Source code @ . Shares 37
Related Posts
About The Author I'm an electronic engineer with over 15 years of
experience in computer programming.
I'm the author of the book . I'm a MVB at DZone and DZone Guide Author. I have contributed to the . I'm the technical reviewer of the book (published by PacktPub).
I love creating IoT projects using Arduino, Raspberry Pi,
Android, and other platforms. I am interested in the convergence
between IoT and the mobile applications.
I'm SCEA, SCWCD, and SCJP
certified. Follow on:
Before you go,Sign up for our NewsletterEnter your email and stay on top of things,
Get SwA updates delivered to your inbox. Article, tips, source code &

我要回帖

更多关于 python int 参数 的文章

 

随机推荐