[Solved] How to save results from the game to text file [closed]

I’ve created a basic class for you that will save the wins to a text file and retrieve them from a text file. import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class WinsFileManager { String path = System.getProperty(“user.home”).replace(“\\”, “\\\\”) + “\\”; public int getWins(String fileName) { String fullPath = path + fileName; int wins … Read more

[Solved] how to make my program check if its a palindrome by ignoring non-alpha characters and white spaces [closed]

After you set your variable “original” to the next line of text, you can call the replaceAll() string method to strip away any unwanted characters with a specifier parameter. Also, you can call toLowerCase() to get all lower case strings. String original, reverse = “”; Scanner in = new Scanner(System.in); System.out.println(“Enter a string to check … Read more

[Solved] webview load url from input text in another class [duplicate]

send data from inputAddrss, Intent intent = new Intent(getBaseContext(), SignoutActivity.class); intent.putExtra(“url”, YOUR_EDIT_TEXT.getText().toString()); startActivity(intent); receive data in MainActivity, String s = getIntent().getStringExtra(“url”); then load into webview view.loadUrl(s); solved webview load url from input text in another class [duplicate]

[Solved] If Else Best Approach In Java [closed]

Break will leave the loop, so booth solutions will only ‘iterate’ over the first item. The second solution without break would be right. (Both solutions would work if you use continue instead of break) solved If Else Best Approach In Java [closed]

[Solved] Java Value must Be Between 0 and 100

The problem you are experiencing is with this piece of code: int percent = (totalDataRead * 100) / filesize; Download.status.setText(totalDataRead / 1024 + “kb/” + filesize / 1024 + “kb”); setProgress(percent); Your value for percent must be outside the range 0…100 as the exception message is coming from the setProgress method: http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html#setProgress(int) Note: IllegalArgumentException – … Read more

[Solved] HTTP POST call from Android [duplicate]

The message says: NetworkOnMainThreadException. In Android applications, one may not execute network code on the Main thread. This means you have to create a separate thread for your code. This can by done via an implementation of the AsyncTaskclass. Look at the documentation solved HTTP POST call from Android [duplicate]

[Solved] maximum from user input + string

You just need to keep both the maximum price and the name of the product with that maximum price. For example, Product[] products = // your products. Product mostExpensiveProduct = product[0]; for (Product product : products) { if (product.getPrice() > mostExpensiveProduct.getPrice()) { mostExpensiveProduct = product; } } System.out.println(“Most expensive product is ” + mostExpensiveProduct.getName() + … Read more

[Solved] Find the Variable with biggest int value

This enum is optional, but helps with code clarity: enum Field { INT_HX, INT_EX, INT_RX, INT_MX, INT_IX } Then test the values: Field largestField = Field.INT_HX; int largestValue = intHx; if(intEx > largestValue) { largestField = Field.INT_EX; largestValue = intEx; } if(intRx > largestValue) { largestField = Field.INT_RX; largestValue = intRx; } if(intMx > largestValue) … Read more

[Solved] onScroll method not working [closed]

place this line after setcontent view text=(TextView)findViewById(R.id.text); like : @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.image); text=(TextView)findViewById(R.id.text); this.detector=new GestureDetectorCompat(this,this); } solved onScroll method not working [closed]

[Solved] Counting amount in Java loop [closed]

You need to declare a variable to hold the sum: int f, sum = 0; for (int k = 1; k <= 6 ; k++){ System.out.println(“Type ” + k +”. number”); f = userInput.nextInt(); sum += f; } solved Counting amount in Java loop [closed]

[Solved] How send e-mail with javaSE1.6 [closed]

You certainly can send mail from within Java SE, you just need to include two jar files with your project: mail.jar and activation.jar. Java EE contains a number of technologies that can be used outside of a Java EE container. You just need to add the relevant library files to your project and thus your … Read more