Posts by Mr_Anderson • 954 points
49 posts
-
2
votes2
answers257
viewsA: Scroll of the slow, heavy Gridview,
The android has few features to display the images (which are usually heavy). To solve this problem, you should use an image processing library (to save you the trouble). An example is the Glide.…
-
1
votes1
answer33
viewsA: ANIMATEDTEXT eliminating all other Activity Components and how to make it run in Textviews?
You used the method setContentView() passing as parameter your animated Textview. You have to pass only the layout through the method, this way: setContentView(R.layout.activity_main); and instead…
-
1
votes2
answers755
viewsA: How to make a button or a checkbox become inaccessible in android studio?
CheckBox meuCheckBox = (CheckBox) findViewByid(R.id.meu_check_box); meuCheckBox.setEnabled(false); (The same method setEnabled(false) is applied to buttons)…
-
2
votes3
answers1946
viewsA: Animate the text of a textView in order to be displayed progressively?
You will create a class that is a custom view public class Typewriter extends TextView { private CharSequence mText; private int mIndex; private long mDelay = 500; //Default 500ms delay public…
-
0
votes2
answers604
viewsA: Recyclerview, problem inserting an item
You should use startActivityForResult instead of startActivity Within onActivityResult, you program to receive an object of type Modelcontact and add in the list that is within Adapter. Finally,…
-
1
votes1
answer51
viewsA: Commands below setAdapter being executed before getView()
It is strange to make Peracao1 and Peracao2 be executed before the listview is mounted, because they are on the bottom line, and in that area the code is executed line by line. But anyway, just use…
-
0
votes1
answer580
viewsA: Recyclerview onClickListener for Activity dialog
Interface: public interface RecyclerViewOnClickListenerHack { public void onClickListener(Usuarios_Model usuario); // obj usuario } Inside the User Adapter: @Override public void…
androidanswered Mr_Anderson 954 -
1
votes2
answers1303
viewsA: Position text in Textviews and Edittexts with an image as background?
You will have to give a padding of, for example, 10 DP in editText. android:padding="10dp" To center, just use in xm ltatambém a: android:gravity"center" To break line into a certain number of…
-
1
votes2
answers556
viewsA: Persistence and reading of Firebase data
To save this way, you will have to have an object that contains the values code, date and user. The user will be an object that must be transformed into JSON (string) before being sent to firebase.…
-
2
votes1
answer267
viewsA: Chat Layout -Flip the side of my message
Well, I did it this way: Using a Recyclerview, I made two Viewholders with their respective xml layouts for the messages (For example, Viewholdermensagemright and Viewholdermensagemesquerda). And,…
-
0
votes3
answers248
viewsA: How to make an Array created within an Asynctask be global?
In addition to the response of Carlos Bridi, there is also an equally legal way, which is similar to the operation of firebase... That is, you create an interface and get it in the asynctask…
-
2
votes6
answers422
viewsA: How to "call" this correctly?
Because when Voce uses THIS inside an onClickListener, for example, you are using this for the onClickListener object. Notice for example, when Voce gives new onClickListener and inside this object…
-
0
votes3
answers458
viewsA: Listview images and quantity - Android
Do not waste time trying to put images in SQLITE. You can do, but it loses type 99% of the resolution, making the image useless. Either you save to drawable and insert the path into db, type…
-
1
votes1
answer115
viewsA: How to pass a certain content contained in a direct first Activity to a third Activity?
Just save it all in a static class. public class Dados{ public String txtAct1 = null; public static Dados instancia = null; public Dados getInstancia(){ if(instancia==null){ instancia = new Dados();…
-
1
votes4
answers304
viewsA: Leave part of the APP in library
I do this: (assuming you know how to use github In android studio, go to file build.Gradle(Module: app) and upstairs, change your apply plugin: 'com.android.application' for apply plugin:…
-
3
votes2
answers1205
viewsA: Call Another Layout
Instead of Intent intent = new Intent(this, R.layout.activity_estado); startActivity(intent); Use Intent intent = new Intent(this, ActivityEstado.class); startActivity(intent); The second parameter…
-
1
votes2
answers92
viewsA: What is the best way to develop icons for Android apps?
It’s in Phophotoshop It is a professional program and in it you will have all the necessary tools to be able to produce icons at a professional level.
-
1
votes1
answer782
viewsA: How to reference an xml button of another Activty?
In an Activity you can only instantiate the buttons that are in the XML you set in the setContentView(R.layout.activity_main); If you try to instantiate a button from another XML, it is null…
-
2
votes2
answers771
viewsA: Make an Acitivity on Android appear only once
You can do it two ways... One is using Sharedpreferences to save a "little tag" and every time you open the app you will have to check if it is there and, if it is, do not open Activity. The other…
-
0
votes2
answers50
viewsA: Layout with listview questions
You need to use a component called Scrollview <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="@layout/minha_tela_">…
-
0
votes1
answer30
viewsA: Difficulty hitting the buttons in the layout
Its "bigger" layout has to have a weightSum of 2, because inside it has 2 other layouts. These two smaller layouts must be Relativelayout with the layout_weight attribute of 1 each layout, to total…
-
0
votes2
answers848
viewsA: What should be the communication between Model and View using MVC?
"From what I understand, the controller does not communicate with Datasource" The control class, which is nothing more and nothing less than Activity, has to communicate with the class that…
-
1
votes2
answers134
viewsA: When do I need to use a class that inherits from an Arraylist of a kind? I don’t understand what that’s for
Serves in case you want to make an arraylist with a behavior of its own... For example, if Voce uses arraylist and imagined a new method that Voce would need to exist but doesn’t exist yet, you…
-
0
votes2
answers55
viewsA: Fileoutputstream fails in context
public void saveDisciplina(String nome, Float p1, Float p2, Context context){ // context recebendo no parametro do método ou no construtor // método } …
-
0
votes2
answers61
viewsA: Edittext with ellipsis
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if(view.hasFocus()){ // se tá com foco, então pôe…
-
2
votes2
answers676
viewsA: Installation of Firebase in Android Studio
This video is old. In the same place where you use libraries, paste: dependencies { compile fileTree(dir: 'libs', include: ['*.jar'])…
-
0
votes1
answer131
viewsA: Finish all daughter threads of an Activity
use the onDestroy method in Activity to effect process completion...although I recommend using a class called Asynctask to perform these processes. @Override protected void onDestroy() {…
-
2
votes1
answer661
viewsA: Update Recyclerview from another Activity
The easiest method is using the Eventbus. The name itself already says... It’s an event delivery (from anywhere to anywhere). It’s just for EventBus.getDefault.register(this); in the recyclerview…
-
2
votes1
answer255
viewsA: Error while displaying information in Android + Firebase listview
Firebase takes place in the background (asynchrony) while your code still runs. Voce cannot enter/retrieve data in firebase and at the bottom line already give Return something pq the methods of…
-
0
votes3
answers686
viewsA: Programmatically change the background color of the Overflow Menu in the Toolbar
setTheme(android.R.style.Theme); //antes de super.onCreate(savedInstanceState);(); If you need to switch in real time, restart Activity.
-
11
votes2
answers8134
viewsQ: What is the right approach to get the click/position in Recyclerview?
What is the right approach to click on Recyclerview? 1 - Inside onBindViewHolder use position, even if within setOnClickListener methods, which turns the position variable into FINAL; 2 - Inside…
-
0
votes1
answer220
viewsQ: Recyclerview makes imageview disappear
Simple. Recycler View makes imageView disappear after I scroll back to the top of the list. For example, in the case, the first image simply disappears. It was like that:…
-
1
votes2
answers102
viewsA: How to set data correctly in Lisview?
Is giving null pointer because you create the adapter as long as the asynktask is doing the data request (it runs parallel to the main code, ie when you arrow the adapter the code of asynktask is…
-
0
votes1
answer49
viewsA: What API to use to create a gallery
You will use a library called Glide or Picasso. They try to load the images in the lists without crashing Android. Example of use: Glide.with(this).load(imagem).into(imageView); //this é o contexto…
androidanswered Mr_Anderson 954 -
3
votes1
answer77
viewsA: How to return to Activity and execute a method?
Step by step: 1 - Create an interface and put a method inside it void resposta(); 2 - Have Activity implement this interface and program within the implemented list update method. 3 - Inside the…
-
2
votes1
answer2246
viewsA: Best Database for Android Application
Android internal bank only has the Sqlite (for small needs such as a simple game). If it’s an external database (for big needs, like a community), then it can be mysql or sql server. It goes from…
-
0
votes1
answer2763
viewsA: How to insert images in Android Studio from a drawable folder?
ImageView imageview = (ImageView) findById(R.id.imagemXml); imageview.setImageResource(R.drawable.imagem1); But it is best practice to actually save the link to the image in the database (better…
-
0
votes2
answers1006
viewsA: How to reload an Activity
Register at act2 and close the act2. Do your search in act1 onResume (the method should be called in the same Activity, and it is automatically called when the screen starts or when another screen…
-
4
votes1
answer64
viewsA: Open Inside of a listview
list.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new…
androidanswered Mr_Anderson 954 -
2
votes2
answers220
viewsA: Choose which Fragment will be shown in Activity
You can receive a Boolean parameter in Activity #2, for example "temCadastro". Do an if in Activity #2 if(temCadastro == true) { digitarSenha(); } else { mostraCadastro(); } Inside the type…
-
0
votes1
answer93
viewsA: How do I make a recyclerview of mine appear on a tab instead of fixed on main?
Activity will contain one Fragment for each tab. Each Fragment will contain one recyclerview. Structure: -activity1|-tab1-fragment1-recyclerview1 |-tab2-fragment2-recyclerview2 In the matter of…
-
1
votes1
answer197
viewsA: How to make a similar google play viewpager?
This, it seems to me, is a viewpager that contains a set of imageviews, as well as a photo gallery. The viewpager obviously only takes half the screen (the viewpager acts as if it were a div of…
-
0
votes2
answers899
viewsA: Pass data from one Activity to another without starting it?
You accidentally called twice the startActivity(abrePost);
-
1
votes2
answers316
viewsA: Ratingbar sending value to Textview android
TextView textView = (TextView) findViewById(R.id.textView); RatingBar ratingBar = (RatingBar) findViewById(R.id.ratingBar); ratingBar.setOnRatingBarChangeListener(new…
androidanswered Mr_Anderson 954 -
1
votes2
answers1836
viewsA: Logged in android user
How is it to test purposes (because there is no bank yet), you can create a Singleton by launching the application. This object stores static information, which means you can access it from anywhere…
androidanswered Mr_Anderson 954 -
3
votes4
answers2661
viewsA: When creating folder inside the folder /res it is not visible in the left panel
The RES folder does not allow creating sub-folders. You can use a plugin to simulate folders in the RES based on file names. Name: Android File Grouping To add to the IDE, press Ctrl+alt+s and go to…
-
0
votes2
answers998
viewsA: Access specific gallery folder
What you want is a gallery filter, for the user to access only certain photos (those of your app) through the native gallery app, right? There’s no way. I’ve gone after it and I’ve spent a lot of…
androidanswered Mr_Anderson 954 -
1
votes1
answer139
viewsA: Take view position on the screen and apply in another view
Use this library that already contains this type of treatment: https://github.com/lgvalle/Material-Animations…
-
1
votes1
answer462
viewsA: How to reuse code from one Activity in another?
Create a separate class and instantiate it by passing this Example Mainactivity.class - contains onCreate and cia methods Meumenu.class - contains the creation method In the onCreate method of…