Posts by Wakim • 10,455 points
263 posts
-
1
votes2
answers88
viewsA: How do I detect that the headset has been plugged in?
Just out of curiosity and to complement the response of the ramaral, which is excellent. There is the possibility to use the Awareness API to detect, when the headset is plugged in and at the same…
-
2
votes3
answers171
viewsA: Is it possible to have properties other than those generated automatically in a data class?
Complementing the excellent responses, you can create immutable properties based on existing ones. Either at initialization/declaration: data class Person(val firstName: String, val lastName:…
-
7
votes4
answers3000
viewsA: Equivalent to the conditional or ternary operator in Kotlin
Just to complement, in version 1.1 came the extension takeIf, that along with Lvis Perator (?:) may contribute in that event. Your expression would be: Log.wtf(GOT, "Run!".takeIf { valirianSteel ==…
-
4
votes1
answer379
viewsA: how to hide a progressBar after given time
I found it strange that the second solution works, because it is still violating the single threading restriction of the framework. The most certain would be the first case because it is not doing a…
-
5
votes3
answers181
viewsA: How do I use the new Java 8 Date API?
I think that none of the answers meet the OP, since he has an interest in JSR 310, which is the new API for working with dates without having to stress deal with classes Date and Calendar java. I…
-
2
votes1
answer120
viewsA: How to modify a Listview present in another Activity without using Intent?
As I said, the simplest way is to use the results of Activity to send a result from MainActivity2 to the MainActivity. Using this technique would look like this: public class Main2Activity extends…
-
4
votes2
answers121
viewsA: Animation when modifying Linearlayout height
The answer has four stages: Get the final size of your container; Get the initial size; Create a ValueAnimator to vary from initial size to final size in 700ms; Set the height value and resize the…
-
5
votes1
answer122
viewsA: What is the difference between marginStart/marginLeft and marginEnd/marginRight?
The big difference between them is only perceived in devices using some language that requires reading RTL (Right to Left) and not LTR (Left to Right) as we are used. It is possible to force this…
-
2
votes1
answer530
viewsA: Scroll View on Android Studio, Basic question
As I commented, just upgrade to any higher version of Android Studio 2.2. In this version is already implemented the scroll of the content of ScrollView inside the Layout Editor.…
-
3
votes1
answer1381
viewsA: Error while trying to generate a signed APK
In this case, the correct one would be to remove the tag <uses-feature> from within <application> and put as child straight from the tag <manifest>.…
-
0
votes1
answer58
viewsA: How do you get that line out of Tablayout?
The TabLayout has some attributes that help to style the tabIndicator. But I believe only to leave the height of tabIndicator equal to zero solves your problem:…
-
2
votes1
answer322
viewsA: My layout has stopped working
So, the Android layout is not HTML. It’s XML, which is a prime of HTML. Joking aside, the problem here is you’re defining the width of the EditText as match_parent, which causes it to overlap the…
-
1
votes1
answer131
viewsA: Kotlin - How to play the effect of "lateinit" on a "var" of an interface?
It is really not possible to define a property lateinit in an interface. But it is possible to define this property as lateinit in the subclass. It would look something like: interface UserManager {…
-
1
votes1
answer118
viewsA: Android - How is gen folder generated?
To change the package where auto-generated classes are created, just change the packageName on Androidmanifest.
-
1
votes1
answer52
viewsA: Catching Event Collapsing Toolbar Android
The AppBarLayout has a Switch to be notified of changes of offset. I believe it is possible to be notified when it is completely collapsed or expanded as follows:…
-
2
votes1
answer84
viewsA: How to create a Double Toolbar?
Whether you are using the Toolbar then the easiest way to have a Extended Toolbar is using a value of layout_height other than ?attr/actionBarSize (which is the default value). In that Chris Banes'…
-
3
votes1
answer196
viewsA: How to Transform a Bitmap into java.io.file to send to Amazon S3
I also use the Amazon SDK to upload to S3 and record the Bitmap in an app cache folder and then move to the SDK. Something like: @NonNull public static File storeOnCache(Context context, Bitmap…
-
1
votes1
answer151
viewsA: Error while picking facebook profile picture
It is not recommended to use ContentResolver to obtain content from the internet, the correct way would be to use a URLConnection or by using an image uploading library, because they eliminate code…
-
1
votes1
answer339
viewsA: onActivityResult does not return setResult
My suggestion is to use your own getIntent, but I believe it is optional (I saw a code of mine that does different and works :P), instead of creating a new one and set the resultCode as RESULT_OK:…
-
6
votes2
answers6010
viewsA: How to import classes like Httpclient, Defaulthttpclient etc
It is not recommended to use the class more HttpClient because of some performance issues (compression, cache and battery consumption reduction). So much so that in version 6, HttpClient is…
-
1
votes1
answer744
viewsA: Recover Selected Radio Button Used Recyclerview
My suggestion is to update the template at each event and then search for this information directly from the template instead of Views. This can be done in a very simple way: 1) Register the Adapter…
-
1
votes2
answers928
viewsA: How to enable the button next to Android to go to a specific field?
I believe the attribute nextFocusDown solves your problem, example: <EditText ... <!-- Demais atributos --> android:nextFocusDown="@+id/proximo_edit_text" /> <EditText…
-
1
votes1
answer38
viewsA: Como definir a categoria de um app no android
Exact, in store settings or App Listing (depending on the locale) of the app in Google Play you can define the category, as well as in the image below:…
-
0
votes1
answer76
viewsA: Application to give directions by gps on android?
If I’m not mistaken, the Google Maps Map API allows starting a Intent that provides this navigation between the current location and a defined point, as if it were a GPS browser. I can’t tell if he…
-
4
votes2
answers787
viewsA: How to view pager images as free market app and others
Starting from the beginning, the new Google library, Design Library brings several ready-made components with some common interactions of Material Design. Just include the library as a dependency on…
-
3
votes1
answer238
viewsA: How can I make my Gridview images to have different sizes
The way I recommend is to use the RecyclerView along with a StaggeredGridLayoutManager. You’ll have something like: RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler_view);…
-
2
votes3
answers783
viewsA: Actionbar in Android Studio 1.4
The right one in this case, using the AppCompatActivity is to use the method getSupportActionBar. If you did not use the support library, you could normally use the getActionBar…
-
1
votes2
answers493
viewsA: Why is my Bean not getting the form Ubmit?
In that case, you should change the process="@this" for process="@form" so the whole form will be processed instead of just the button. With the form being processed, all components within it will…
-
1
votes1
answer92
viewsA: Why is Floatingactionbutton transparent?
It seems to me that this is a bug of Android 10 that was fixed in version 14, from a look at Volume #183315 but that appeared during version 23.0.0 of the design library. There are two solutions,…
-
5
votes2
answers1195
viewsA: Remove shadow between Toolbar and the rest of the layout
The shadow you see is from AppBarLayout, to get out is just set: <android.support.design.widget.AppBarLayout ... app:elevation="0dp"> Being from the design library, the AppBarLayout defines an…
-
0
votes1
answer123
viewsA: Load layout with Preferencefragment in a Drawerlayout
There are two ways to use a Fragment of support library to display Preferences. Using the new PreferenceFragmentCompat Using the PreferenceFragmentCompat of preference-v7 is quite simple. Only this…
-
0
votes1
answer159
viewsA: How Gradle Scripts works
Yes, with minSdkVersion you guarantee part of the backward compatibility. I will explain further why only part of it. By quickly answering the first question, yes, not only with the minSdkVersion…
-
8
votes1
answer9504
viewsA: Creating tabs the right way on Android currently
The best way to implement a tab-based layout is by using the TabLayout of design library. Unfortunately it requires you to have the trio in your dependency group: compile…
-
1
votes1
answer268
viewsA: commandbutton executes method, but being null values. Why are inputstexts values not being assigned to class attributes?
The problem is that your <p:button> is with the attribute process="@this". This means that in the AJAX request that is made, only it is processed. So that the rest inputs of your form are…
-
5
votes3
answers958
viewsA: ANDROID: How to identify user screen density?
The qualifiers cited are densities, where mdpi is the baseline. And the rest are proportional to mdpi. That is: ldpi = 0.75 * mdpi hdpi = 1.5 * mdpi xhdpi = 2.0 * mdpi xxhdpi = 3.0 * mdpi xxxhdpi =…
-
4
votes2
answers599
viewsA: What are the names of the Tabs (Tabs) that are being used in the new apps?
In the principle of Material Design this component is called Tabs, just like that. In the case of Youtube, there is a ViewPager with the tabs component, where each item in the ViewPager has a tab…
-
5
votes1
answer85
viewsA: Images loaded in Listview are changing randomly
Rafael, this problem is expected by the way it was implemented. You are not doing any treatment to check if at the end of the download, that image should still be shown for that Imageview. This is…
-
4
votes1
answer1127
viewsA: Imageview - Defining Drawable by path
My suggestion for this case is to use the API of Resources to do so. Given the name of Resource it is possible to recover your identifier with the method below: public int…
-
1
votes1
answer93
viewsA: 3 layouts and an Activity
The simplest way would be to pass the Resource of layout for Extras, and recover in the next Activity: public void onClick(View view) { int checkeRadioButtonId =…
-
1
votes1
answer141
viewsA: Prevent multiple clicks on Android
Yes, this problem occurs because it postpones click detection using the post and postDelayed, and this will line up the events of ACTION_UP. This can be seen by the source code of the class View: //…
-
1
votes1
answer171
viewsA: I cannot import the lib aacdecoder correctly
My suggestion is this:: 1) Remove native libraries from folder libs, leaving them only in the folder jniLibs. 2) Remove the jar from the aacdecoder of the briefcase jniLibs, leaving it only in the…
-
2
votes2
answers2551
viewsA: Android - Cycle to check if a Checkbox is enabled or not
My suggestion is very simple, use a Timer to perform a verification task at certain periods: private static final long INTERVAL = 4000l; Timer mTimer; Button mButton; Checkbox mCheckbox; TimerTask…
-
5
votes1
answer2332
viewsA: Refresh activity after swiping your finger on the screen
To use the SwipeRefreshLayout is quite simple. 0 - Configuration If you have not yet used Support Library v4, then add the same to your project: dependencies { // Demais dependencias do seu projeto…
-
1
votes1
answer3710
viewsA: Center background image
My suggestion is to organize your View's in "layers", having a ImageView at the end, with the Drawable that has the image you want to center. By doing this you can center a certain "layer" without…
-
2
votes1
answer891
viewsA: How to set margin in a Textview in java source code?
Just set the margin on LayoutParams of View and request a new assessment of the Layout: View view = ... ViewGroup.LayoutParams lp = view.getLayoutParams(); if(lp instanceof…
-
2
votes1
answer108
viewsA: Help to Compare ID to String
My suggestion is to save the status of the selected colors and text in Activity, as well as possible values vectors as constants: public class RunActivity extends ActionBarActivity { // Valores…
-
6
votes2
answers1016
viewsA: How to create Production Application Error Report (Client)
Exactly like the Paulo Rodrigues cited, Android, more specifically JVM, allows to register a Handler for Exception's untreated. And, I believe, any library that allows report use the same technique.…
-
8
votes2
answers2292
viewsA: How to save a list of elements with Shared Preferences
An alternative to serialize in any version is to create a JSON, in case an array, from your contacts collection, and save as String in the SharedPreferences. To serialize Just create a JSONArray,…
-
1
votes4
answers2941
viewsA: Primefaces datatable number formatting
If you want a input then the @Anderson response is more appropriate. If you want just one OutputText or OutputLabel i recommend creating your own convert, would have a better semantics, a clearer…
-
2
votes1
answer306
viewsA: Google Maps Navigation Material Design
I believe you’re looking for Androidslidinguppanel, is a library providing a Widget with the functionality you are looking for. Integration with the Google Maps is simple, in my example I made the…