Posts by itscorey • 2,686 points
80 posts
-
4
votes2
answers2112
viewsA: Mascara for money on android
Use the class Numberformat to solve your problem. It is a class of the SDK itself and is very easy to use. Use: String money = NumberFormat.getCurrencyInstance().format(0.01); Return: R$ 0,01 The…
-
7
votes1
answer12496
viewsA: Change the Android App icon
Simply replace the icons that are present in the folder res/mipmap. The icon, in this case, is called ic_launcher and ic_launcher_round. The second uses rounded edges, is a round icon. You can…
-
2
votes1
answer148
viewsA: Beginner questions about creating app on Android
You will first need to generate your signed APK and in Android Studio itself you do this. You will need to create a Keystore with some people information so you can subscribe to your app. This…
-
0
votes2
answers813
viewsA: Start an app with a screen that isn’t Main?
As I already explained in my reply here, it is recommended that you use a SplashScreen for such. I’m going to try to explain to you, in a simple way, how this structure should work, especially in a…
-
2
votes1
answer444
viewsA: Logout when closing app
I had recommended that you could use the method onDestroy, which is called when the system needs memory or when the Finish() method is called. But this might not work in some cases. So, the best…
-
0
votes2
answers68
viewsA: Problem with Bottonnavigationview
I don’t know what your root layout, but if it is a Relativelayout you can use the attribute android:layout_above="@+id/idDoBottomNav". Root layout is the one that is responsible for saving your view…
-
0
votes3
answers422
viewsA: How to pick any button through Onclick?
In your XML you can use the attribute onClick so that they all make a call to the click method. XML <Button android:id="@+id/buttonOne" ... android:onClick="onButtonClick"/> <Button…
-
1
votes1
answer560
viewsA: Show Toast in a non-Activity class
public static void logout(Context ctx) { auth.signOut(); alert(ctx, "..."); } private void alert(Context ctx, String s) { Toast.makeText(ctx, s, Toast.LENGTH_SHORT).show(); } The logout method…
-
1
votes1
answer849
viewsA: Button that calls another screen and another button on the new screen that goes back to the old screen
Screen 1 final Button myButton = (Button) findViewById(R.id.myButton); myButton.setOnClickListener(View.OnClickListener { @Override public void onClick(View v) { Intent i = new Intent(this@Tela1,…
-
0
votes1
answer117
viewsA: Array of numbers with variable amount Java Android
Your code will only present problems depending on where you position the variable listNumbers1. Basically, you need to position it in the class scope if you want to keep the access modifier private,…
-
1
votes1
answer137
viewsA: Bottomnavigationview is not at the bottom of the screen
I think it’s because you’re replacing the contents of LinearLayout adding a Fragment to it. This sort of removes your content, which in this case is the Bottomnavigationview. Use a Relativelayout as…
-
3
votes1
answer495
viewsA: Botao FAB does not stay in place
He won’t stay in place because you didn’t apply any constraint for him. And the editor should warn you this with a sign warning. The attributes editor_absoluteY/X only serve to give a visual effect…
-
1
votes1
answer990
viewsA: How to center the string of the bar action title and how to change its size?
I believe this is a very pertinent doubt in the development for Android, because it is not enough to just try to apply a Gravity in it, because the Toolbar, being a ViewGroup, is occupied by other…
-
3
votes1
answer164
viewsA: Take data from 2 Ragments by clicking an Action Button (Toolbar)
I believe the simplest way to do that is to warn Activity that the user typed the text and thus send the respective text through a Listener, which was the method you quoted to know, where there is…
-
1
votes2
answers100
viewsA: Do you need to use Appcompat and Support Design libraries when the minimum API is 21?
If your API minimum now is 21, you will no longer need to use these support libraries. Even. They serve to offer device compatibility pré-loolipop (API 21), that is, for devices with an API between…
-
3
votes1
answer57
viewsA: Layout weigth does not work Android
This is because you specified a size for each View. Basically, when you assign a weight to a View you cannot assign a size to it, ie if you want the width or height carry a weight, the value of each…
-
1
votes1
answer33
viewsA: How to add Id to canvas on Android?
The easiest way to do this is to create a Custom View. Not to mention that this will probably avoid Boilerplate in your code. private class CircleCanvas extends View { public CircleCanvas(Context…
-
4
votes2
answers660
viewsA: Create "forgot password" links on Android
There are two options that solve your problem, they are: you can use a Button or a TextView. Button The first, which is the most common to be used, you must have come across the problem of having a…
-
4
votes2
answers7146
viewsA: round edge on Edittext Android
You can use xml-drawables to get this result, but there is also another alternative if you want to, for example, apply shadows to your view instead of leaving it with a more stoned look. XML…
-
1
votes3
answers185
viewsA: Animation in images
Use the method View##Setrotation() of the component itself Imageview. imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imageView.setRotation(90); }…
-
0
votes1
answer221
viewsA: Toggle Tabs in Viewpager via the Fragment button
You’ll just need to define one method in his Activity that changes the Viewpager and then make a reference to their Activity of which the Fragment is attached and then you will have free access to…
-
0
votes2
answers339
viewsA: Swipe Refresh in Textview
swipeLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { updateMessage("Hi, Jarbas"); } } ); // ... private void updateMessage(String msg) {…
-
5
votes1
answer940
viewsA: Limit amount of typed characters based on view width
As stated in the comments of the question, to do this you would have to measure the size of each character inserted in the EditText, and it’s not as hard as it looks. I did in Kotlin, because since…
-
1
votes1
answer231
viewsA: How to create a Cardview like Google Play
The problem is you didn’t define a child main to the cardview. This Child, who will be a viewgroup will organize all other views within the cardview arriving at the result you want.…
-
1
votes1
answer370
viewsA: Imagebutton does not display properly image background
This is the background pattern of a imageButton. You can change it by changing the attribute android:background of the component itself. Some people use the background as @null…
-
0
votes3
answers1340
viewsA: How to recover all data inside the key in Firebase
Try the following DatabaseReference ref = FirebaseDatabase.getInstance().getReference(); ref.child("uploads").addValueEventListener(new ValueEventListener() { @Override public void…
-
4
votes2
answers275
viewsA: How to create a configuration screen in an Android app that appears only at the time of user registration?
How are you utilizing the firebase, I believe that it is not necessary to use the Sharedpreferences in this case, because as you want to define a nickname immutable if it does not exist, you will…
-
6
votes2
answers1398
viewsA: Java to Kotlin conversion
The recommendable of language Kotlin, for many, is that you start to rewrite your project instead of translating it. To be more direct, there are some advantages between rewriting and translating a…
-
4
votes2
answers612
viewsA: Count the number of characters and insert a new one into a given position, into a string?
You can use the method Stringbuilder::Insert to insert the number 9 in the position you want according to the size of your String. We can do it this way: public static void main(String[] args) {…
-
6
votes2
answers1548
viewsA: How does Asynctask actually work?
AsyncTask is one of the classes that implements competition in the Android and basically, it helps other classes like: Thread. Currently, any event or modifying which occurs in a app, is managed in…
-
1
votes2
answers261
viewsA: Problem with animation in Android Studio
The problem is that your animation is not applied to any View, except in itself, which is not a view. When you create an animation via XML, your goal is to animate some view belonging to your…
-
3
votes1
answer169
viewsA: How to animate a view through XML file?
You need to start seeing this: View Animation Here’s an example of how we can make a Blink Animation. That’s the kind of excitement that gets blinking to view. Blink.xml <?xml version="1.0"…
-
1
votes1
answer858
viewsA: Firebase , how to play an audio in the firebase Audio Log by clicking a button?
First, you need to know how you are dealing with these Áudio. As you yourself quoted, it is not recommended to store very large files in the application, the question is: do you have these pre-made…
-
0
votes1
answer59
viewsA: How to save the id of a relativeLayout?
Your code isn’t working because you’re comparing one View with a whole. The right thing would be to take the Id of view the method receives as a parameter, thus: public void selecionaMenuTec(View…
-
6
votes1
answer761
viewsA: Help with React Activate
Create a file called local.properties and go to the folder android of its Reactnative. The file extension must be .properties. Put the following configuration inside the archive:…
-
1
votes2
answers731
viewsA: How to run the click event on an image that is in Activity’s Fragment?
I’m going to assume you’re not getting your reference ImageView in your code, ok? If I’m wrong, let me know. Anyway, what do you do to get the reference of widget is to use the myview as an…
-
2
votes2
answers1423
viewsA: How to change the app title source?
To Toolbar is a ViewGroup, this means that you can group other Views within it. Doing so: <android.support.v7.widget.Toolbar android:id="@+id/app_toolbar" android:layout_width="match_parent"…
-
3
votes3
answers2538
viewsA: How to install nodemon globally?
In some facilities of Node, the prefix is not assigned in the way of the environment variables, then what you install globally does not work as expected. To resolve this, we have to add the prefix…
-
2
votes1
answer1077
viewsA: When should I use Constraintlayout?
When you need to layouts more complex and will need a more precise hierarchy. The ConstraintLayout was created in accordance with the doc, to create screens with a more precise hierarchy, without…
-
3
votes1
answer61
viewsA: Passage of parameter Drawable object
According to the documentation, the parameter that must be passed to setSmallICon is a Int instead of a Drawable. So your code should be like this: public void exibirMensagem(String titulo, String…
-
0
votes1
answer304
viewsA: Which method to use Sharedpreferences best?
The best way to store your Token is when the user is successfully connected, that is, when the Token has already been successfully created. After that, just save the Token. For example, the user…
-
1
votes2
answers980
viewsA: Analyze sound waves from an MP3 file and representation
There are two libraries that can do this for you: Miniequalizer and Vumeter. They have the same effect and if you look at their source code, you’ll see that they inherit from a View, which gives you…
-
0
votes2
answers637
viewsA: How to place a texView inside a Circle
layout_rounded_background.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid…
-
1
votes1
answer138
viewsA: Regressive Clock
Use the class Countdowntimer. new CountDownTimer(tempo, 1000) { public void onTick(long millisUntilFinished) { long millis = millisUntilFinished; String hms =…
-
3
votes2
answers832
viewsA: Press the button of a screen that is a Fragment and go to another Fragment. How do you do?
There’s another way to do that. And maybe it’s simpler than it looks. Fragment View.OnClickListener onClickHandler = new View.OnClickListener() { @Override public void onClick(View view) {…
-
1
votes1
answer89
viewsA: How to activate saving battery?
You cannot activate the economia de bateria programmatically. This is because the android itself does not have a native function that does this and/or does not allow it. You can only do this if the…
-
0
votes1
answer78
viewsA: Code does not read ELSE
public void onClick (View View) { // RESISTENCIA DO CONCRETO if (txt_resistencia_concreto.getText().toString().equals("")) // O que faltava era o toString() showError("Campos em branco", "Preencha a…
-
4
votes4
answers14893
viewsA: Advantage and advantage between onClick and setOnClickListener
I believe there is only one difference or different mode of application. The methods are similar, whether you indicate your action by clicking the button on XML how to handle this action by…
-
0
votes1
answer2642
viewsA: How to display an entire variable in a textView and add +1 to it each time I click on a button present in the same Activity?
Just use the method OnClick() of button. To use this method, you need to apply a Onclicklistener in his Button. package genesysgeneration.a10; import android.support.v7.app.AppCompatActivity; import…
-
2
votes1
answer126
viewsA: Remove setError after field is completed
You need to use the class Textwatcher in your(s) EditText. EditText userName = (EditText) findViewById(R.id.username); userName.addTextChangedListener(new TextWatcher() { @Override public void…