Posts by Piovezan • 15,850 points
395 posts
-
1
votes2
answers246
viewsA: How to notify the user that an FTP file is up to date?
You need a library that provides an API to access the FTP server and return the necessary information regarding the files present on it. Then every time your application runs, it will connect to…
-
1
votes1
answer435
viewsA: Alarmmanager - Time-specific notification
Include the <receiver> in the AndroidManifest.xml: <receiver android:name="pacote.onde.está.a.classe.AlarmReceiver" />
-
1
votes2
answers4866
viewsA: Java.lang.String cannot be cast to error , when capturing data in Jcomobox to save
Your call (Funcionario) cbNomeUsuario.getSelectedItem() is trying to convert to the type Funcionario an object of the type String, which is being returned by cbNomeUsuario.getSelectedItem(). Are…
-
8
votes4
answers33277
viewsA: Using the keywords Throws and Throw
The keyword throw serves to cast an exception (more precisely a Throwable, but in 99.9% of cases an exception). The keyword throws to declare that a method may make exceptions of a particular type.…
-
15
votes3
answers96047
viewsA: What is the use of a static or final variable in java?
The modifier final in variables means that you cannot assign value twice to the variable. The modifier static means that the variable belongs to the class, not to the object; this means that all…
-
0
votes2
answers1332
viewsA: Transfer files. class to the /web-inf folder in Eclipse
I’m assuming your application server is Tomcat. The briefcase src is only important to generate the files .class, but the files in src are not required to run the application on the application…
-
6
votes1
answer218
viewsA: Events on buttons
Suppose you have two Activities, to AtividadeA and the AtividadeB, and that the AtividadeA will have a button that will call the AtividadeB. It works that way: 1) In the layout of your first…
-
2
votes1
answer1887
viewsA: How to customize java.io.Ioexception error message on Android?
The error is already being customized by the library/method that is producing the IOException. In that case the solution would be to capture this Exception in a block catch() and launch a new…
-
13
votes5
answers13518
viewsA: Hide the keyboard
I believe that clicking outside Edittext will not make the virtual keyboard disappear. You need to implement a System that hides the keyboard when you click out of it (that is, when Edittext loses…
-
6
votes2
answers257
viewsA: Asynctask x Multithreading
AsyncTasks use Threads under the table, and serve to simplify the display on the screen of the progress of the operation being made in background (before, during or after its execution). But as…
-
1
votes3
answers4496
viewsA: Click and hold the Button / Listview
All subclasses of View (TextViews, ImageViews, etc.) have a method setOnLongClickListener() which receives as a parameter an implementation of View.OnLongClickListener. Now just search for examples…
-
0
votes4
answers138
viewsA: How to get the last more "+" that appears on the console from this code?
From what I understand of your code, it works well when the lowest value of j for which array[j] == 1 is 0, and works badly (displays the + a further) when the smaller j for which array[j] == 1 is…
-
2
votes1
answer1016
viewsA: How to grab images from a folder on Android?
You cannot save images downloaded by your app to the folder res/drawable/ because it is intended to save images available to the application at project time, that is, before it is compiled. You will…
-
4
votes1
answer387
viewsA: How to send/encapsulate a file in a . apk to use in the app installation?
You can include your file . xls in the folder res/raw/. There is also a folder in the project assets/, and there is little difference between storing in it or in the folder res/raw/. You can know a…
-
4
votes2
answers4514
viewsA: How to create menu on Android?
Are you having any specific difficulty? Otherwise, just create a file res/menu/menu.xml with menu items having each item a title and a drawable icon, as exemplified in own documentation: <?xml…
-
3
votes4
answers10133
viewsA: Develop iOS apps using Java
If you want to develop to OSX, which is the Mac system, you can use Ides like Eclipse, Netbeans or Intellij Idea. Already the iOS is the iPhone/iPad system and its applications are developed…
-
8
votes1
answer3020
viewsA: What is the best way to create methods accessible to any Ctivity?
The possible ways of doing (which occurs to me) are: 1) Create a Superactivity that other Activities extend and therefore inherit the method in question: Upside: If placing the method in a…
-
1
votes1
answer347
viewsA: Restart requestLocationUpdates() with Sleep
How Locationmanager and Locationlistener work The method LocationListener.onLocationChanged() is called whenever there is a new position obtained by GPS or triangulation antennas available…
-
0
votes1
answer865
viewsA: Update Progressbar in the background java android
The service can’t call progressBar.setProgress() directly. He needs to find a way to ask Activity visible at that time when this method is called. I see two possibilities: the first, which is not my…
-
5
votes1
answer651
viewsA: Arraylist returning null values
Your code has some errors, I will explain the modifications that would need to be performed: Main class: Its code demonstrates a custom, possibly inherited from C programming, which is to declare…
-
0
votes1
answer196
viewsA: "No view found" error closes my application
From time to time when you try to create an Android project containing a activity in the Eclipse ADT, this now includes a fragment along with the activity. For beginners, however, I find it very…
-
1
votes3
answers581
viewsA: Error: Sorry the Aplication.... has unexpectedly stopped Please Try Again Java Eclipse
Apparently the error is in this line of Mainactivity.java: BTsoma.setOnClickListener(new View.OnClickListener() { The reason is because BTsoma is getting the value null on that other line: BTsoma =…
-
0
votes1
answer731
viewsA: Service is stopped when running on BOOT_COMPLETED
What seems to me to be happening is the following: your service creates an instance (object) of Timer calling for timer, but this instance will only last as long as the Service is running, after…
-
4
votes1
answer374
viewsA: Threads running problem, using flags
What is causing racing conditions in its code is the fact that access to variables is not atomic, that is, they are concurrently accessed by more than one thread. If you want these variables to be…
-
15
votes1
answer11955
viewsA: Difference between Handler and Thread
First, a basic concept (if you already know this part, you can skip to the last paragraph): There is the thread main, also called UI thread, whose central function is to perform UI (user interface),…
-
2
votes2
answers1603
viewsA: Delete All Sharedpreferences from Android App
Do so: SharedPreferences.Editor prefsEditor = getSharedPreferences(arquivo, 0).edit(); prefsEditor.clear(); prefsEditor.commit(); This will remove all stored values.…
-
6
votes3
answers949
viewsA: How does the Xor Swap algorithm work?
First, let’s remember some properties of XOR (exclusive-OR): A A = 0 neutral element: A 0 = A commutative: A B = B A associative: (A B) C = A (B C) The following is a retracted explanation from…
-
1
votes1
answer1035
viewsA: How to download a file and open it at the end of the download?
First let’s go to the error of -1 being returned by getContentLength(). getContentLength() returns the value of header content-length present in your HTTP request response. This header may not be…
-
1
votes3
answers4187
views -
2
votes2
answers2314
viewsA: The method openOrCreateDatabase(String, int, null) is Undefined for the type Bancodedados
Are two mistakes. The first is that you are trying to call a method that does not exist in the class BancoDeDados. That’s because BancoDeDados needs to be a subclass of SQLiteDatabase, or contain an…
-
2
votes3
answers787
viewsA: problems to print a double number
If you just want to truncate the value to one decimal place, you can do so: DecimalFormat df = new DecimalFormat("#.#"); System.out.println(df.format(x/y));
-
3
votes5
answers2656
viewsA: How to manage a Sqlite connection between multiple simultaneous threads?
Synchronizing the opening, reading/writing and closing methods of the database individually does not solve an essential problem that is the need for access to the database to be atomic. It would…
-
3
votes3
answers2228
viewsA: How to make a simple square on Android?
As it seems to me you want to add a square to a GridLayout, the simplest solution would be to create a View, set a background color and include it in the GridLayout: View view = new View(this);…
-
6
votes2
answers756
views -
0
votes5
answers1154
viewsA: Map does not load, showing error
This Exception probably means you don’t have the app Google Play Services installed. Download it from Google Play (using the app Play Store), run your project again and see if the error goes away.…
-
2
votes1
answer223
viewsA: How to make maps work on old and new Apis at the same time?
Android supports fragments in older versions (up to 1.6) as long as you replace the classes related to this feature with equivalent classes that are in the revision support library 4. To use these…
-
1
votes3
answers878
viewsA: Unsuccessfully installing an app on a Genesis GT-7240 tablet
If your AndroidManifest.xml have permission ACCESS_FINE_LOCATION and the device does not have GPS (which seems to be the case of this tablet), will not install. The reason is simple: this permission…
-
5
votes8
answers3054
viewsA: When to use Waterfall and when to use Scrum?
When to use Waterfall? When the requirements are well defined and without perspective of change, such as the construction of a building. That is, very rarely in the case of software. With the…
-
6
votes4
answers8554
viewsA: How do LTRIM() and RTRIM() in Java?
The library Apache Commons has methods in class StringUtils that can remove several characters from the beginning or end of a string: On the left: String semEspacosOuTabulacosAEsquerda =…
-
0
votes4
answers10518
viewsA: Eclipse menus are gone
If you click on this place they come back?
-
0
votes3
answers184
viewsA: Do you have an Eclipse feature that includes "this." before any variable where this is implied?
If what you want is to avoid typing this. before each variable, just use ctrl + espaço that the variables belonging to the scope of this. appear for you to choose (autocomplete feature).…
-
1
votes5
answers1939
viewsA: Sending form via AJAX, method PUT
I think the problem is you’re using the enctype: 'multipart/form-data' or in any other way informing the server that the request comes from a form. According to this response in the OS GET, POST,…
-
1
votes2
answers2102
viewsA: How to compare Date class to System.currentTimeMillis() in Java?
Do it this way: if (object.getDate().after(new Date(System.currentTimeMillis())) // do something But even if you are using Java below version 8 is sure to let go of Date and use the library…
-
12
votes2
answers235
viewsQ: How to avoid an Illegalstateexception: The content of the Adapter has changed but Listview Did not receive a notification?
I have a Activity that displays a ListView, to which a Adapter "backed by" a ArrayList global. If I add an element to that ArrayList, ideal is to do it in the main thread and immediately call…
-
12
votes3
answers13164
viewsA: What are the default sizes of android images?
I’m not going to give an extensive explanation here, I’m just going to teach you how to calculate the image sizes for each density, which is the point of the question. For a general explanation of…