java

java

  • All Sites

1 answer

Adding Google Map to a fragment

so i'm developping an application with fragments .I have 3 action bars , in one of them i want to display google map in order to allow users to search stores on the map (example).I dont know what to ...

0 answers

Json exception only on some devices

I'm having some problems in deserialize a long Json file with Gson google api. I tested this application on different devices, but on one of them there's a problem: it doesn't work and it throws a ...

2 answers

Tried Euler's #14 again with recursion, didn't work for me. SPOILERS EULER 14th

I posted earlier trying to bruteforce it, but it didn't work. Here's my attempt #2 with recursion (first time using recursive methods). Please help! Here's what happens: The code runs fine, with ...

2 answers | 2 mins ago by Cflo on Stack Overflow stackoverflow.com
0 answers

JSP Tag Files in subdirectories, using a single taglib prefix

I know that I can do this with a TLD file but to confirm with existing structure, I'd prefer not to create this file. I need to reference tags within /WEB-INF/tags and /WEB-INF/tags/children under ...

1 answer

503 Error ObjectifyService NoClassDefFoundError

I am having issues with GAE in the api explorer.I am trying to use objectify to save to a datastore but I am getting this error: { "error": { "message": "java.lang.NoClassDefFoundError: Could not ...

0 answers

How to run java code through eclipse console?

I have virtually no java/eclipse experience, so bear with me. I have written a code to use the Euclidean algorithm to compute a greatest common divisor. public class Euclid { public static int ...

2 answers

ActionBar not working when extending ListActivity

I have a confusing problem. I have a MainActivity with 2 actions : Update and Logout. The problem is when I run the activity that extends ListActivity the action bar doesn't appear. Below I have 2 ...

0 answers

Getting a true(1) or false(0) from specific sql statement

I need help with the code below and getting it to return a true or false value. Any and all help would be appreciated. public synchronized static boolean checkCompanyName(String companyName, ...

1 answer

Add parentheses around rounded decimal place

I have to round a number to the third decimal place and display the number like this, 123.12(3). I need some help getting the (#) around the number. Here is the code I have: DecimalFormat ...

1 answer

How to split up integers using printf in Java

Hello everyone I was having some issue splitting up a user input number using printf (I do have to use printf). My problem is that when I put in say the number 12345 it will print the integers on five ...

1 answer

Android setting custom actionbar

In my project i would to set a custom actionBar (with a custom layout) after a specific action. I have this simple Activity: import android.os.Bundle; import android.support.v7.app.ActionBarActivity; ...

0 answers

How to Insert a value where not exist in SQLite Android

I want to insert values into my table only when values don't exist in the table. String CREATETABLE = "CREATE TABLE contacts ( " + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + ...

4 answers

Sort a list based on two conditions

So, I don't know if there is an elegant solution to this but here goes. I want to sort a list but the list contains three types of items. What i want is for type A to be on top sorted alphabetically, ...

4 answers | 10 mins ago by Sree on Stack Overflow stackoverflow.com
0 answers

Texture size with Libgdx

It may be a dumb question but I need a little help / explanations. I can't manage to resize correctly my textures when I resize the window in libgdx. I want to keep the aspect of my textures or have ...

2 answers

How to read a ServletInputStream more than once when you don't have control of the code that reads it a second time

I have a ServletInputStream that I need to read more than once (the code that reads it the second time is in an API I don't control). When using IOUtils.copy, it still seems that the stream is only ...

2 answers | 11 mins ago by mstrom on Stack Overflow stackoverflow.com
1 answer

Libgdx can't batch timer properly

I'm trying to build a timer, but something is going wrong and i can't find out what. That's why I'm doing this question. Anyways, below is my code that's doing this so far: ...

1 answers | 12 mins ago by pMpC on Stack Overflow stackoverflow.com
4 answers

How can i get this to execute to two decimal places, comes out as long decimal

int ptstotal, ptsearned, ptssofar; ptstotal= 1500; ptsearned= 750; ptssofar= 950; System.out.println("The current percentage is "+(int)Math.round(ptsearned*1)/(double)(ptssofar)*100+"%."); ...

4 answers | 12 mins ago by squash69 on Stack Overflow stackoverflow.com
1 answer

Only use library if available java

In C++ or C, you can do things like this: #ifdef WINAPI public void showWindow(int cmdShow); #endif But in java, how can I define methods, that will only be compiled when user has enabled a ...

1 answers | 13 mins ago by Tomáš Zato on Stack Overflow stackoverflow.com
2 answers

How to get the value of an enum being passed to the JNI

I have a Java application and JNI (dll). I want to know how to get the value of the enum (int) that is being passed as a parameter to the JNI. Here's the enum (Java): public enum envelopeType { ...

2 answers | 14 mins ago by BebzSusuma on Stack Overflow stackoverflow.com
0 answers

Soap Web Service client from java class using saaj

I am working in application in wish i need to invoke soap web services. To do so i am using SAAJ. For testing I made the method below to call a service. This service return a String that receives ...

1 answer

OneToMany bidirectional association example

I'm new to Hibernate and I'm trying to establish a OneToMany/ManyToOne bidirectional relationship between Person and Vehicle classes. In my example a Person can have many Vehicles and a Vehicle ...

1 answers | 17 mins ago by user2953113 on Stack Overflow stackoverflow.com
0 answers

Struts2 Action Mapping 404

I have a Struts2 application running on a Glassfish 4 container. The application consists of one action class SampleAction package com.mysample.action; public class SampleAction { public String ...

0 answers

Xamarin Android GCM Shutting Down VM

When using Google Cloud Messaging on Xamarin Android the app is becoming unresponsive on register. Here is my code: Thread t = new Thread (new ThreadStart (delegate { Console.WriteLine ...

0 answers

How to share constants across different Android Studio modules

I am building a library project in Android Studio using several modules that I have written. My main module, ModuleA, has the following string declared in one of my classes: public static final ...

0 answers

Jitsi 2.5 does not receive IMs on Ubuntu?

Jitsi 2.5.5065 on Ubuntu does not appear to receive IMs sent from GTalk accounts unless the chat is already open. If a chat is not open, then Jitsi briefly says the person is typing, but then closes ...

3 answers

multiple insert with sequence fails in Postgres

There is one insert query with multiple values (about 18k): INSERT INTO ENTRIES (ID, USER_ID) VALUES (nextval('my_seq'), '233'),(nextval('my_seq'), '233'); Which is fired from liquibase changeset ...

3 answers | 18 mins ago by sandris on Stack Overflow stackoverflow.com
6 answers

The 'if' Statement is Redundant

I am trying to code a validation system to validate if the user has inputted in the fields required. I seem to be getting an error "The 'if' Statement is Redundant" can someone help me fix this ...

6 answers | 21 mins ago by Joe Cobain on Stack Overflow stackoverflow.com
1 answer

onSensorChanged() is not called

I'm having a lot of trouble tonight with sensors, but it appear it is because of onSensorChanged() is not called. Sorry for the eventual duplicate question, but I didn't see any solutions. Here's my ...

1 answers | 22 mins ago by Thomas on Stack Overflow stackoverflow.com
3 answers

Tree implementation in Java (root, parents and children)

I need to create a tree structure similar as the attached image in Java. I've found some questions related to this one but I haven't found a convincing and well explained response. The application ...

3 answers | 24 mins ago by Carlos on Stack Overflow stackoverflow.com
3 answers

org.apache.jasper.JasperException: An exception occurred processing JSP page /editinfo.jsp

I have this jsp code where I am trying to edit information for the user my web page. I am new to jsp programming and I'm experiencing errors. Here is my code: <%@page ...

3 answers | 24 mins ago by achll on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3