Posts by ramaral • 44,197 points
1,060 posts
-
1
votes2
answers3625
viewsA: Android, pick up id of an item from a listview through long click
If the adapt associated with your Listview for a Cursoradaptar the parameter id passed to the method onItemLongClick(), of the interface Onitemlongclicklistener, represents the value of the field…
-
2
votes3
answers126
viewsA: Run block if no exception occurs
The try/catch allows you to deviate the normal sequence of code execution when an exception occurs. If there is no exception, the execution follows the normal sequence. try { sout("Texto na tela");…
-
1
votes1
answer231
viewsA: Listview Fragment
One of the most important topics we should understand when using Fragments is your life cycle. The method onCreateView() is called whenever the Fragment needs to be displayed on the screen. As you…
-
8
votes3
answers673
viewsA: Functions with Textbox and Buttons type parameters
All components that have visual representation inherit from the class Control. Change your method to: private void Visible(Control x, Control y, Control z, Control a) { x.Visible = true; y.Visible =…
-
0
votes1
answer43
viewsA: Edit default Errotemplate layout
Explain in detail how to create/change a template it’s not easy to do it here. I leave two examples that I use: Redborderonerror - Apply a red border and show a tooltip with the error message when…
-
2
votes1
answer88
viewsA: Mainactivity with Login
Instead of launching the Activity Login with startActivity() do it with startActivityForResult() //Constante para identificar o resultado static final int TEXT_RESULT = 1;…
-
1
votes1
answer279
viewsA: android.widget.Linearlayout cannot be cast to android.widget.Listview
The mistake is due to the fact that you are trying to "transform" a Linearlayout in a Listview. The method onCreateView() serves to inform the class Fragment which the layout it must use which, in…
-
23
votes2
answers3644
viewsA: What is the use of using?
The use of using allows classes that implement Idisposable are used in such a way as to ensure the execution of the method Dispose() at the end of its use, even if an exception is made. using (var…
-
2
votes1
answer1012
viewsA: Get white space from a string
My Pascal is long forgotten but I think he can do something like that: Var S : String; S:=StringOfChar(' ',Length(ASuaVariavel) - Length(TrimLeft(AsuaVariavel)); Edit after your comment In the…
-
2
votes2
answers944
viewsA: Right-click options menu selected in datagrid
So that the Contextmenu appears only when a selected line is added Itemcontainerstyle to his Contextmenu <ContextMenu.ItemContainerStyle> <Style TargetType="{x:Type MenuItem}">…
-
3
votes1
answer729
viewsA: Search data from related tables
You can add other include to his expression LINQ List<Usuario> lista = banco.Usuario .Include("Tipo") .Include("NomeTabela") .ToList(); Edit After seeing its entities: Using LINQ:…
-
2
votes3
answers1117
viewsA: How to use Gesturedetector?
To detect the movement of Swipe above the buttons or any other view, without having to implement this logic in each of the views, we need to find a way to intercept that movement before they. The…
-
1
votes1
answer1908
viewsA: Android:get value from Radiobutton
The problem is you’re using the method findViewById() of Activity and not of Radiogroup. The method seeks a View with that id in Activity as she does not have it he returns null. Change the line:…
-
4
votes1
answer35
viewsA: Error while trying to pass ticket[i] = i;
Your array is declared to have 5 items: int[] ticket = new int[5]; The problem with your code is assuming that the first item in the array is Indice 1. Arrays indices in C# and most languages start…
-
2
votes1
answer804
viewsA: Right-click options menu in datagrid
To declare a context menu for your Gridview add that code to her statement: <DataGrid.ContextMenu> <ContextMenu> <MenuItem Header="Titulo do menu" Click="metodo_a_chamar">…
-
3
votes1
answer1100
viewsA: Consuming JSON webservice with the use of Asynctaks
The exception Networkonmainthreadexception is launched when a program target API level 11 or higher accesses the internet on application’s main thread. From what I see in your code what probably (I…
-
0
votes1
answer96
viewsA: Cheackbox on a Basedapter, how to use it?
You have to create declare a Onclicklistener and associate it with Checkbox of view of each of the rows on your list. Within the method onClick put the code you want to execute whenever the Checkbox…
-
3
votes1
answer102
viewsA: Why do I only see the last one when I insert three objects?
Start by creating a Stand. Stand stand = new Stand(); Whenever the 'Insert' option is chosen you must create a new car, fill its attributes and, at the end, add it to the Stand. case 1: carro = new…
-
1
votes2
answers114
viewsA: Map variable only gets null value
Reading the documentation to Supportmapfragment I see that the method getMap() is considered obsolete and that the method getMapAsync() So add to your class Mapafragment the following method:…
-
2
votes1
answer890
viewsA: Change the Listview Background color when the key value is found
The problem here arises for the same reason as your other question. Android, so it is not necessary to always be doing the inflate view of each of the Listview, has a mechanism that allows reuse…
-
1
votes1
answer80
viewsA: Doubt regarding the function is
There are two commands that can be used to modify the normal execution path of loops: break and continue The break causes the loop is completed immediately, continuing execution from the instruction…
-
0
votes2
answers3168
viewsA: Count duplicate values in list
Once you have the values in a BD, why not get this data already in the form you want? Assuming your BD access class is db and that the name of the column that wants to know the number of occurrences…
-
2
votes1
answer184
viewsA: Print more than 1 java value
The error is due to the fact that you declare the matrix to have 6 rows and 114 columns and only assign values to 6 rows and 2 columns. The value returned by mat.length; is 6 and mat[i].length; is…
-
0
votes2
answers320
viewsA: How to create Exception
If you’re sure what you want is to launch a Exception so here it goes. In the method setNome class Partner test the past value. public void setNome(String nome) { if(nome == null || nome == ""){…
-
3
votes1
answer535
viewsA: Notification at a certain time with no need to open the program
Define a Alarmmanager to call a Broadcastreceiver which will launch the notification: //Definir a data Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2015);…
-
1
votes1
answer167
viewsA: Create a constant that loads multiple images and shows them on the screen
From what I understand are 3 your difficulties: Assign a value to each image Draw one of 3 images Display a picture every x seconds Start by declaring two arrays, one with the ids of Drawables which…
-
0
votes1
answer89
viewsA: My custom Dialog only appears after the to run all
Dialogs are executed asynchronously: the method show() returned immediately after being called, continuing the execution of the program on the next line. That’s why during the execution of for…
-
15
votes6
answers56799
viewsA: What is Nullpointerexception and what are its main causes?
The exception Nullpointerexception is launched when trying to use an object that has not yet been instantiated. Based on this class: public class Endereco{ public String rua; public String…
-
7
votes2
answers5978
viewsA: Best practices when presenting Android loading screen
It depends on where/how you trigger the request: if it is a button o Progressbar can appear on the button itself, if it is on Actionbar the same thing, when filling a list may appear in the list,…
-
0
votes1
answer158
viewsA: How to create a Listview with Random items? (Android)
Instead of trying to do it on Adapter do it directly on the Arraylist. After filling the list use the method shuffle class Collections. Collections.shuffle(listaCardapio); The items of listaCardapio…
-
5
votes3
answers7481
viewsA: Compare Two dates and time
If you use the class Calendar everything becomes simpler. Write a method to convert an object Date in Calendar with the option of "zero" part of Team. public static Calendar DateToCalendar(Date…
-
5
votes1
answer1408
viewsA: Android display a screen only the first time you open the application
Use the Sharedpreferences to save the app version. In the main activity, in the method oncreate(), obtain that information and act accordingly. String appVer = "versão actual da sua app";…
-
2
votes1
answer256
viewsA: Toolbar with separator at the bottom
Instead of a Imageview use a View with the background the color you want and set the height in android:layout_height <android.support.v7.widget.Toolbar android:id="@+id/toolbar" ........ ........…
-
1
votes1
answer326
viewsA: Put an off service button on notification of an Android App
Create a Broadcastreceiver with the code needed to stop the service. When creating the notification use the method addAction() of Notification.Builder passing a Pendigintent what’s up with this one…
-
6
votes3
answers557
viewsA: Unsigned int doesn’t work?
Attribution converts -1, which is a int, for unsigned int. The rule of conversion of Signed-to-unsigned is (INT_MAX + 1) - intValue, in this case as intValue is -1 the result is INT_MAX If you use…
-
0
votes2
answers92
viewsA: Index creation in the table
Your question only arises because the table has 45 columns that can be used to limit the query. If the problem is these columns we’ll get rid of them. If the 45 columns can only have two values:…
-
3
votes1
answer1664
viewsA: How to prevent Alertdialog from being closed when a button is clicked?
I use a device I found no longer remember where. Start by defining a class that will treat event onClick dialog button: public abstract class DialogButtonClickWrapper implements OnClickListener{…
-
17
votes3
answers8471
viewsQ: Is a subquery in SELECT calculated for each result or just once?
Based on this example, where the result will be used to calculate the percentage of occurrence of each 'guy', which approach is more efficient/faster? Use a subquery in the SELECT to calculate the…
-
4
votes2
answers6301
viewsA: Remove an item from a List<>
Use the method Remove class List<T> private List<Carros> GetCarros(long userId, List<Carros> list) { var retornaCarros = _CarrosRepository.GetCarrosType(CarrosType.ROSA.Value,…
-
3
votes1
answer204
viewsA: How to convert numbers 2.15600e+03 (Uler) to numeric type?
Use the class Double to make the conversion: To long: long longVar = Double.valueOf("2.15600e+03").longValue(); To double: double doubleVar = Double.valueOf("2.15600e+03").doubleValue();…
-
1
votes2
answers164
viewsA: App Automaticao Residencial
You can use Sharedpreference to store button states. Start by declaring a Hashset that will save the buttons that are ON: private Set<String> botoesOn; In each of the methods onClick() button…
-
0
votes1
answer276
viewsA: Why is my Listview showing just one line?
The problem lies in the fact that your RelativeLayout be of a height set for 48dp Change the line: android:layout_height="48dp" for: android:layout_height="wrap_content"…
-
0
votes1
answer572
viewsA: Using Foreign key with Cascade
It is through the use of Foreign keys(Foreign Key) that the Relational Databases ensure the Referential integrity (Referential Integrity). Foreign keys serve to define relations between tables. The…
-
3
votes1
answer1074
viewsA: Background Color of Listview in zebra
I think you’re using the so-called "View Holder Pattern" and is reusing the Views using the Layoutinflater only when the parameter convertView of the method getView() of Adapter is null. So, how do…
-
5
votes1
answer2951
viewsA: JOIN 3 different tables display list
If I understand correctly what you want what’s missing is to add to SELECT the column name table Customer $result = mysql_query("SELECT customer.name, type, date, amount FROM payment LEFT JOIN…
-
8
votes1
answer609
viewsA: How to compare "set" images in Imagebuttons?
You can use the method getConstantState() to check whether two Drawable are the same. Bitmapdrawables created from the same Resource share the same bitmap stored in their Constantstate. imgBt1 =…
-
1
votes1
answer2054
viewsA: Find directory using wildcards
Can(*) use the method GetDirectories() class Directory to get the path of directories that are in the directory c:\minhapasta\ and that match the search pattern t* Dim dirs As String() =…
-
2
votes1
answer1864
viewsA: How to show "wait, load data" using asynchronous programming?
Not knowing how your code is structured instead of responding using async and await I present a solution using the class Task: MostraAguarde(true); var task = Task.Factory.StartNew(() => {…
-
2
votes3
answers5685
viewsA: How do I open a file from a specific directory in . PDF in Visual Basic 6?
C# and Windowsforms private void button1_Click(object sender, System.EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\" ;…
-
1
votes1
answer1527
viewsA: Get field for longest date
Return the MAX(status.) SELECT numero.id, numero.numero, MAX(status.status), MAX(status.data) AS data FROM numero INNER JOIN dados ON numero.id = dados.id_numero INNER JOIN status ON (numero.numero…