Posts by ramaral • 44,197 points
1,060 posts
-
2
votes1
answer46
viewsA: Fragmentactivity with Actionbardrawertoggle
I think he’s using the v7 appcompat library. To gain access to Actionbar your Activity shall inherit from Actionbaractivity or better than Appcompactactivity since Actionbaractivity was considered…
-
2
votes1
answer103
viewsA: My program has performance issues
The program takes a long time to present the data because it is blocked waiting for the other to finish. Do so: // Esse método que inicia todo o processo private void Confirmar_Click(object sender,…
-
2
votes1
answer688
viewsA: How to capture text that another console program writes on the screen
Before making process.Start() place true in process.StartInfo.RedirectStandardOutput and false in process.StartInfo.UseShellExecute Supposing you want to receive the output of the program…
-
2
votes1
answer1016
viewsA: How to keep the selected item color fixed
1 - Add the attribute android:choiceMode à Listview, to allow selecting only one line: android:choiceMode="singleChoice" to select more than one line: android:choiceMode="multipleChoice" 2 - Add the…
-
5
votes2
answers209
viewsA: Create Fibonacci in a linear function with delegate
You should take each of the values in your list and calculate the corresponding value in the Fibonacci series It would be something like that: public List<int> novoFibonacci(int tamanho) {…
-
6
votes2
answers1800
viewsA: How to return Activity call data to the one who called it?
The mechanism used to receive values from a Activity after it is abandoned is, by evoking it, to use startActivityForResult() instead of startActivity(). At first Activity: static final int…
-
2
votes2
answers104
viewsA: Understanding a delegate’s lambda parameters in a function
Func<int,int> declares a delegate representing a function that receives a parameter of type int and returns a value of type int. Taking your example the result of return calcFib(tamanho); will…
-
2
votes1
answer271
viewsA: Edittext issues in a listview
The problem is that whenever the Edittext is reused using the holder, you are added a new Textwatcher. The solution goes through before adding a new Textwatcher remove the previous. public class…
-
4
votes1
answer1575
viewsA: How to run java at the Eclipse prompt
Directly, through the Eclipse, is not possible. You have to export the application as "Runnable JAR file" and execute it on a command window: Right-click on your project: Choosing Runnable JAR file…
-
5
votes2
answers186
viewsA: How to modify an existing System.out.println
Use System.out.print() and the escape character \r at the end of the text: public static void teste(int maximo) { for(int i = 0; i < maximo; i++) { System.out.print(i + " de " + maximo + "\r"); }…
-
13
votes6
answers2762
viewsA: How to walk an Enum?
Instead of a Enum use a Dictionary: Dictionary<string, int> valorLetra = new Dictionary<string, int>(); valorLetra.Add("a",1); ..... .... valorLetra.Add("z",26); string teste =…
-
3
votes1
answer598
viewsA: Capture events on volume button
Instead of action android:name="android.intent.action.MEDIA_BUTTON" use action android:name="android.media.VOLUME_CHANGED_ACTION" in the Intent-filter of your receiver: <receiver…
-
7
votes1
answer250
viewsA: First element in listview does not appear
Analyzing the following part of your code: Cursor cursor = db.rawQuery(sqlQuery,null); cursor.moveToFirst(); while (cursor.moveToNext()){ ..... ..... } check which cursor is positioned on the first…
-
4
votes1
answer1342
viewsA: Avoid saving duplicate data
If the data read from xml are stored in a List<T> before being saved to the bank then delete duplicates from the list before saving. A simple way to do this is to use the method…
-
2
votes2
answers345
viewsA: Android sqlite order by com case
I’m not sure I quite understand your question because you can use the method rawQuery() thus: String query = "SELECT ProDescricao FROM ProdutosDB " + "where ProDescricao like %?% " + "ORDER BY CASE…
-
7
votes2
answers1209
viewsA: Can Enum values only be integer?
Enum represents a set (enumeration) of constants. Each enumeration has an integer type associated with it, except char, the default type is int. The types allowed are byte, sbyte, short, ushort,…
-
2
votes1
answer114
viewsA: List of forms in the project
Using Reflection can obtain the name of all classes of the type Form in this way: IEnumerable<string> formNames = from t in Assembly.GetExecutingAssembly().GetTypes() where t.IsClass…
-
11
votes8
answers2805
viewsA: How to know which is the last element on a list?
You don’t need to know the last item on the list. After the foreach take the string and do this: //Remove a virgula e adiciona o parêntesis sql = sql.TrimEnd(',') + ")"; String.Trimend…
-
2
votes2
answers837
viewsA: Android Progressdialog does not appear
The reason for this is due to the call of the method get() class Asynctask in the method StartDownload(). public boolean StartDownload(String string){ BitmapDownloaderTask object = new…
-
1
votes1
answer94
viewsA: How to create a sound library?
Your file on audio was recorded in the past path to the method myRecorder.setOutputFile();: outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/javacodegeeksRecording.3gpp";…
-
2
votes1
answer90
viewsA: Information on Title - WPF
I haven’t tried it but I think it does what it wants. In the Usercontrol declare a Dependencyproperty public string TitleValue { get { return (string)GetValue(TitleValueProperty); } set {…
-
4
votes1
answer322
viewsA: Bring only the name in Listview, but relate to the ID
How do you intend only that the list present the nome a simple way is to do the Override of the method toString() of your class User: public class Usuario { int id; String nome; ..... .....…
-
2
votes1
answer572
viewsA: How to return more than one value using an Asynctask on android?
A method only returns one type of data, however, this type need not necessarily be a type simple as int, String, Boolean, etc.. So when you want to return a data set, you use a class. Write a class…
-
4
votes1
answer295
viewsA: Retrieve the last saved photo and insert it into a View image every time Activity starts
One of the possible ways is to save the photo path using Sharedpreferences. Write two methods, one to keep and one to read the path. private void savePhotoPath(String photoPath){ SharedPreferences…
-
5
votes2
answers676
viewsA: How to access the SDCARD on Android 4.4(API 19)
The latest smartphones may have more than one External Storage. Beyond the sdcard have an intern. The path returned by Environment.getExternalStorageDirectory() refers to the primary external…
-
1
votes2
answers548
views -
6
votes1
answer1287
viewsA: How to resolve Networkonmainthreadexception error?
The exception in question, Networkonmainthreadexception, is launched when an application tries to run a network operation on Main thread. Android, from its version 3(API 11), forces this type of…
-
5
votes3
answers1630
views -
2
votes1
answer611
viewsA: How to read a Json without knowing what is inside it or the amount of data?
If the structure of Json is always the same can make a Parser using the class Jsonreader. For the example you posted would be like this: public ArrayList<String> getValuesFromJson(String…
-
1
votes1
answer323
viewsA: Set maximum height for Alert Dialog
As I said in the comment do not create Listview in JAVA code, but in an XML layout. Create the layout in the same way as if it were to be used in a Activity. dialog_list.xml <LinearLayout…
-
4
votes3
answers117
viewsA: Architectural problem where access to construction methods should be controlled
This type of problem can be solved by Composite Design Pattern Composite is a software design standard used to represent an object that is composed of objects similar to it. In this pattern, the…
-
4
votes1
answer88
viewsA: How to implement this class in a Textview , so that it works correctly?
I assume you mean using this Textview in a layout. So, once you have the class in your project, you can use it in XML in the same way as any other View. The only difference is you must use the full…
-
1
votes1
answer2393
viewsA: Take the path of an image in the Gallery
If you are downloading the Gallery image using Intent.ACTION_PICK may, in the method onActivityResult(), use Uri imageUri = intent.getData(); to obtain the Uri to image data. Use the method…
-
5
votes1
answer767
viewsA: How to make a smooth animation in Progressbar?
First a small explanation to understand why this happens. Knowing why the solution is simple. The animation consists of varying the position of the Progressbar, from the maximum position to the…
-
1
votes2
answers940
viewsA: Doubt how to call several different images
Start by writing two classes to represent the items and each of the images (colors): //Representa um item ex: Borracha, bola etc. public class Item { public Item() { Imagens = new…
-
4
votes1
answer4993
viewsA: How to change the font color of the application title
Android 2.1 and higher If you are using Support Library change the file values/Styles.xml to look like this: <resources> <!-- Base application theme. --> <!-- Esta primeira linha…
-
2
votes2
answers211
viewsA: Entity Framework 6 Async and method . Wait()
In doing montarconfiguracao.Wait(); he freezes because that’s what Task.Wait() makes: expect that the Task finalize. So that this does not happen change the code to: public class CrawlBO { public…
-
6
votes2
answers718
viewsA: How do I add two strings in C#?
How do you talk about converting to ulong I’ll assume that the strings represent whole. public string Somar(string numA, string numB) { BigInteger bigA = BigInteger.Parse(numA); BigInteger bigB =…
-
2
votes1
answer753
viewsA: Spinner to select Color
In the folder res/drawable create a Drawable in the shape of a circle: res/drawable/Circle.xml <?xml version="1.0" encoding="utf-8"?> <shape…
-
0
votes2
answers922
viewsA: Load Map in Fragment - Android
You are not initializing the variable mContext. Do the Override of the method onAttach() of Fragment and boot it there: @Override public void onAttach(Activity activity) { super.onAttach(activity);…
-
1
votes2
answers239
viewsA: How to start an Edittext as null?
The visibility of a View can be indicated using the method JAVA setVisibility() or the attribute XML android.visibility. So that your Edittext boot as invisible do: In the XML <EditText…
-
0
votes2
answers330
viewsA: How to create notification with custom layout?
Create notification in the usual way: Notification.Builder builder = new Notification.Builder(this) ..... .... .setAutoCancel(true) .setContentIntent(pIntent); Create a Remoteviews with its layout:…
-
1
votes1
answer313
viewsA: Proportional area use with Gridlayout
Use a Linearlayout and use the attribute android:layout_weight to define, proportionally, the space that each View occupies, then assigns that layout to the zero column of its grid indicating a span…
-
9
votes1
answer907
viewsA: Thread or Asynctask? When and which one should I use?
Asynctask is a class that facilitates the use of threads in conjunction with the Main Thread. Asynctask creates an internal Thread to execute the code declared in the method doInBackground() and a…
-
1
votes2
answers6796
viewsA: Mysql error 1215: Cannot add foreign key constraint
Two things: 1 - You are trying to create a FOREIGN KEY referencing a table that does not yet exist. The creation of the table correntista has to be done after the creation of the other two. 2 -…
-
2
votes1
answer221
viewsA: How to recover Activity, instead of creating new, when you click on the notification?
In the Androidmanifest.xml, in the declaration of activity, place: <activity android:name="........ ............ android:launchMode="singleTop" ...... ......> </activity> Or set as flags…
-
4
votes1
answer426
viewsA: How to get the path to my Sqlite database?
If your database was created in the traditional way using the class Sqliteopenhelper, can get her way through: String dbPath = context.getDatabasePath("nome da db").toString();…
-
1
votes1
answer85
viewsA: Notification - Customize Actions
How are you using a custom view as layout of the notification, instead of using addAction(), your layout shall provide buttons which, when clicked, will execute the actions. The Intent’s intent and…
-
2
votes1
answer709
viewsA: Force menu display in mobile phone action bar with menu button
I suppose you must be wearing the v7 appcompat library and Theme.AppCompat.Light.DarkActionBar as Theme of the application. The attribute showAsAction, when used with the library, has to be preceded…
-
3
votes1
answer504
viewsA: Count and access checkbox marked
The fact of Chckbox’s be in a Dashboard will facilitate your counting in a loop. The object Dashboard keeps a list of objects of type Control that are on the "inside" of the property Controls. Just…