Posts by ramaral • 44,197 points
1,060 posts
-
0
votes1
answer68
viewsA: Method setEmptyView is not working on my listview
In order for Listview to control the View to display when it is empty it is necessary that it is at the same level in its hierarchy. The way you’re doing it doesn’t happen. Do so: //inflate da…
-
4
votes2
answers1423
viewsA: How to change the app title source?
One of the new features made available from Android is the possibility of use fonts as Resources. Now, in addition to the traditional Resources, it is possible to add a folder named fonts inside the…
-
1
votes1
answer70
viewsA: Expandablelistview Clickable Items
You must provide Expandablelistview with a Onchildclicklistener for it to use/call whenever an item is clicked: expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {…
-
11
votes2
answers675
viewsA: Sum of Timespan in C#?
How this sum operation of the two Timespan structures works? This works because C# allows operator overload, defining static methods using the keyword operador. To overload an operator it is…
-
6
votes1
answer56
viewsQ: Object state invariance check between private methods execution
In this reply to the question How to test private methods in C#? is referred to The maximum that can be interesting is to have an object state invariance check between the execution of private…
-
1
votes1
answer61
viewsA: Prepend in an Edittext using Textwatcher
Use the method afterTextChanged() textwatcher: @Override public void afterTextChanged(Editable editable) { if(editable.length() == 1 && !editable.toString().equals("(")){ editable.insert(0,…
-
5
votes1
answer1215
viewsA: How to change the background of a button when clicked?
You are not changing the background button. To do this you must use the method setBackground() Instead of btn.getResources().getDrawable(R.drawable.curisoidade_desligado); use…
-
12
votes4
answers3416
viewsA: How to do a search to know if a string is inside a vector in C#
The problem is that in the second for the message is displayed as soon as it finds a different name. No need to go through the array twice. If it is traversed to the end without finding, it is…
-
1
votes1
answer242
viewsA: Display problem of a setText
The reason is that it is not allowed to use objects that use the UI, as is the case Textview, in a Thread other than the Uithread(Mainthread). In the method run() of Thread use the method…
-
5
votes2
answers258
viewsA: Finish the last Asynctask before starting another
By default tasks, created using the Asynctask class, are executed sequentially in a single background thread. To know the status of a task use the method getStatus(). He returns a enum of the kind…
-
0
votes1
answer209
viewsA: Error picking ID or Position inside a Spinner
I see no reason for that to happen. However, if the reason of AdapterView.OnItemSelectedListener is only for "set" the attribute posicao, to then know which item is selected in Spinner elsewhere,…
-
1
votes1
answer112
viewsA: Round rating for fixed stars
The method setRating() gets a float to be able to consider the decimals to partially render the star. However, for it to work, it is not only necessary that the value it receives has decimals, it is…
-
3
votes2
answers5047
viewsA: How to properly organize DP and DPI for each screen type on Android?
Is there any kind of formula or way to know the following questions without having to "build" all the time to check? There is no "formula" but there is a way to know without "need to stay "building"…
-
39
votes2
answers3085
viewsQ: What are the main differences between Kotlin and Java?
I have long been aware of the existence of the Kotlin language. I know that you need JVM to run and that it is completely interoperable with Java. At the time I did not give her much attention but…
-
0
votes1
answer287
viewsA: Error calling getLayoutInflater() inside a Fragment
Error indicates that this method can only be used within the group com.android.support, that is, its use is restricted to the API/LIBRARY. I can’t verify it but it should be noted with…
-
7
votes3
answers119
viewsA: Why declare property twice in one class?
The first purpose of the existence of properties in C# is to allow the class to publicly expose values(state) while keeping private(encapsulated) its implementation and validation. This is achieved…
-
1
votes1
answer166
viewsA: How to put more information in the window by clicking a Marker?
If what you want is just to add a string underneath the Marker title use Markeroptions#snippet(String snippet). map.addMarker(new MarkerOptions().position(location) .title("MarkerX")…
-
1
votes2
answers70
viewsA: Change background color when Listview has no items
Before making the list available to Adapter check that it is empty and change the background of Listview accordingly. Anything like that: if(lista.size() == 0){…
-
2
votes1
answer779
viewsA: Dotted Line (Dotted/Dashed Line)
What could be causing this is the use of the unit px for the dimensions of android:dashWidth and android:dashGap. On devices with high pixel density screen it is possible that 10 pixels are not…
-
2
votes1
answer49
viewsA: Change icon color in API 19 Kitkat
This can be achieved by resorting to compatibility libraries. Compatibility libraries allow existing features in new versions of android to be used in older versions. To the utilise should download…
-
4
votes2
answers68
viewsA: Sound only plays in debug mode
The "play" of a sound by Mediaplayer is initiated by the method call mp.start(). However the sound is "played" asynchronously, that is, after called, the method mp.start() returns immediately. Thus…
-
1
votes2
answers379
viewsA: Error when using Google’s API to run from Android 2.3 (API Level 9)
Version 10.0.0 of Google Play services is the latest to support Android version 2.3(API Level 9). Version 10.2.4, the one you are using, requires Level 14 API as a minimum. You have two…
-
3
votes3
answers10056
viewsA: How to run the emulator from the windows command line?
To run an emulator via command line use the following command: emulator -avd avd_name [ {-option [value]} … ] For example, if you have an emulator named Nexus_5x_api_25_x86 the following command…
-
3
votes1
answer303
viewsA: Error when comparing an Edittext to a String
You are comparing one Editable with a String. The object returned by the method Edittext#gettext() is of the Editable type. To get the string in Edittext you have to use the method toString()…
-
1
votes1
answer352
viewsA: Android Tablet Incompatible App (Playstore Info)
Android can run on different types of devices. It is present on phones, tablets, televisions and even on cars. The hardware of each of these devices has different characteristics, which requires…
-
1
votes1
answer94
viewsA: How to get the Listview reference of a Listfragment?
To take advantage of all the features of Listfragment Listview should have the id thus declared: android:id="@id/android:list" or android:id="@android:id/list" This way it is possible to obtain the…
-
3
votes1
answer177
viewsA: How do you pause Chronometer and pick up where you left off?
The value shown by the chronometer is calculated by the difference between the current instant(SystemClock.elapsedRealtime()) and the reference value - the one that was "set" through setBase().…
-
2
votes2
answers809
viewsA: Send data from a Fragment to an Activity
Extras are stored in the Inside in key/value format. Thus, in the intent.getStringExtra() must use the key used in the intent.putExtra(). Change the Activity code like this: Intent intent =…
-
3
votes2
answers939
viewsA: Android - Invalid Resource Directory Name
The folders of an Android application follow a well-defined folder structure and names. By default the Resources of the kind layout should be placed in the folder path_do_projeto app src main res…
-
4
votes1
answer585
viewsA: Enable GPS within the app
That I know the only possibility is to use the Settingsclient from Google, which I believe is what the Google Maps app uses. The API allows an application to easily ensure/verify that device…
-
3
votes1
answer1792
viewsA: How to take Activitb’s Intent values and move to Activitya in a List?
When an Activity is brought to foreground one of 3 methods is called and receives the Intent that gave rise to that fact: onCreate() - When a new Activity instance is created. onNewIntent() - When…
-
4
votes2
answers2415
viewsA: How to get your Android device ID with Telephonymanager#getDeviceId()?
I’m not sure to get the ID that way? Not for the end you want. Telephonymanager#getDeviceId() returns the IMEI on a phone GSM or the MEID or ESN telephone CDMA. Not all Android devices are phones.…
-
4
votes1
answer1210
viewsA: Test effective internet connection
It’s one thing to have an active network connection(network) another is to be able to access a resource on the Internet. Checking the existence of an active connection can be done with the code…
-
3
votes1
answer44
viewsA: How to reverse the animation of an Animated-vector?
From that create another <animated-vector> representing drawable in the state checked. from_checked_drawable.xml <?xml version="1.0" encoding="utf-8"?> <animated-vector…
-
3
votes1
answer772
viewsA: Items repeating in a Recyclerview
Recyclerview.Adapter implements the "View Holder" standard using the Recyclerview.Viewholder class using it in the methods onCreateViewHolder() and onBindViewHolder(), allowing a previously created…
-
2
votes1
answer682
viewsA: How to convert 32(24) bit color to 16 bit?
Colors obtained in Colordialog are in RGB8888 format, where each color is represented by 8 bits plus 8 bits for alpha channel. There are two 16-bit RGB formats, RGB555 and RGB565. In the first, the…
-
12
votes1
answer3646
viewsA: Intent to open link in browser does not work
Your code is correct. What should be happening is that you are using a URL without the protocol, like "google.com". The URL should include the "http://" or "https protocol://". String url =…
-
4
votes2
answers755
viewsA: Where to store API connection credentials on Android
"The best way to protect secrets is not to put them in the code." Not being possible, these are some of the options where to store them: In string Resources. Hidden in source code. Hidden in…
-
0
votes1
answer63
viewsA: getView is not being called but getCount has items in Listview
You are popular with an instance of Listview that is not the one presented in Fragment. The Listview that is presented in Fragment is in the layout which is created in the onCreateView(), through…
-
0
votes1
answer487
viewsA: Fragment is not overriding the marked layout
It is not possible to replace the layout of Activity with that of Fragment. In terms of layout, what the method replace() replaces the layout of a Fragment, previously added to the specified view…
-
2
votes1
answer214
viewsA: What is the difference between Preference and Sharedpreference?
Sharedpreference It is a system that allows to access and store, persistently, values referenced by a key. Access to the system is obtained through the methods Context#getSharedPreferences() or…
-
4
votes1
answer1958
viewsA: What is the real difference between a button and an imageButton?
The differences come from the class from which each descends. Button descends from Textview. Makes a clickable Textview by adding a visual effect when clicked. Imagebutton descends from Imageview.…
-
3
votes2
answers173
viewsA: Create a Resource string or a class of counters?
For the case you refer to, key to a value stored in Sharedpreferences, you must use constants. The Resource string is intended for text to be presented to the user, taking advantage of its…
-
3
votes1
answer329
viewsA: How are expressions evaluated in Java?
Interpretation is simple if you understand what are compound assignment operators and suffix/prefix operators. The compound allocation operator performs the operation between the two operands and…
-
2
votes1
answer146
viewsA: How to show the old android timePicker ? the one that appears only the numbers
In the onCreateDialog(), of Timepickerfragment, return the Timepickerdialog created this way: return new TimePickerDialog(getActivity(), AlertDialog.THEME_HOLO_DARK, this, hour, minute,…
-
3
votes3
answers1946
viewsA: Animate the text of a textView in order to be displayed progressively?
Resorting to Property Animation system(Properties animation system) of the SDK is possible to achieve the effect you want. This approach allows having to "free" all the functionalities of the…
-
6
votes1
answer75
viewsA: Obsolete html.fromHtml for Android N+
In fact Html.fromHtml(String source) is now considered obsolete. This, however, does not imply that it cannot be used. Because there is no other option, in case you want the app to run in versions…
-
3
votes1
answer37
viewsA: Is it possible to create a Page View from null?
The example referred to in documentation that’s right: an example. In it is used only one Fragment that is used on all pages. What you need to do is: create a Fragment for each of the pages that…
-
2
votes1
answer76
viewsA: How to get pixel color played on screen on Android? (Without using images)
If you know how to do it with an image(Bitmap) then you only need a Bitmap that plays Textview. The following method returns an image(bitmap) that represents the contents of view past tense. public…
-
3
votes1
answer278
viewsA: Why should I keep audio and video files inside the raw folder?
Android SDK tools compile features(Resources) together with the application torque(1). During this process symbols (class R) are generated for each one, in order to be accessed in the code. The R…