Questions tagged as 'java'

1
answer

ERROR: android.view.InflateException: Binary XML file line # 0: Error inflating class TextView

Using LayoutInflater with this XML gives the following error: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:...
asked by 17.02.2018 / 13:01
2
answers

Add results and display separately within the loop

I'd like to know how to add multiple results. I'm creating a simple application for a particular financial challenge. For example: double salario = 1500; double desafio; for(double mes=1; mes<=12; mes++){ desafio = (salario * mes)/100;...
asked by 14.01.2018 / 12:53
2
answers

Help with String algorithm

I need to make a program in which the user types a string and substring, and tells how many times this substring occurs in the main string. Ex: Main chain: "banana" Substring: "na" Repetitions: 2. I've already thought about using a String vec...
asked by 24.02.2018 / 14:27
1
answer

Doubt in Toast.makeText (this, ...)

This is the same code as a previous question, but now my question is different. No Toast.makeTest(this, msg, Toast.LENGTH_SHORT); gives the following error at compile time, I believe because of the context of this this : error: non...
asked by 21.07.2018 / 17:46
1
answer

How to use scroll keys, such as up, down, on the keyboard to navigate a list of buttons?

I have these buttons implemented with a click of the mouse, but I wanted the following: I could navigate through the direction keys up and down and enter through enter . Does anyone know how to implement it? They are the buttons: btStart,...
asked by 11.01.2018 / 04:23
2
answers

Error with SQL and MariaDB (Current position is before the first row)

I have a problem with my database and I have no idea what it is. public String getBlockPermission(String blockstring){ String permission = ""; try{ ResultSet res = connection.createStatement().executeQuery("select permission fr...
asked by 06.01.2018 / 08:25
2
answers

How to make a minimum ceiling and a maximum ceiling in a random number? [duplicate]

I'm developing an application in Java and in my controller I have a function that generates the random numbers. Example: In my first column I want you to manage from 0 to 8, until then OK. In the second column I want to generate 9 to 17,...
asked by 17.12.2017 / 20:55
1
answer

Exercise with HashMap

I'm trying to do this exercise, I do not know where I'm going wrong. Can you help me? I need to create a map that has the key number of the characters in a city name and a value in a list with all names with that number of characters. You...
asked by 07.12.2017 / 19:25
1
answer

Different results with the same SQL statement

Speak programmers, easy? I've done a lot of research not to repeat questions here, but I really do not understand why the SQL statement works in MySQL Workbench and the Java / JDBC SQL string does not. I have two game and category tab...
asked by 24.08.2018 / 23:54
1
answer

Can anyone tell me why my console does not show any results?

Get a n value and print the following table using the for : 1 2 4 3 9 27 4 16 64 256 n n² n³ ... n^n I tried: import java.util.Scanner; public class Questao4 { public void Cadeia() { Scanner num = ne...
asked by 23.08.2018 / 03:54