Posts by Murillo Comino • 1,133 points
58 posts
- 
		0 votes2 answers78 viewsA: Print variable in javaWelcome to Stackoverflow, you just need to put the password variable in your Textview... to do so remove texto.setText(R.id.gerarsenha); and put texto.setText(senha); Would look like this: public… 
- 
		0 votes1 answer24 viewsA: How can I take the result of the imc to and put in another Textview??? I tried this wayYour if Else is always being true, you need to insert the variable imc to make the comparisons, the correct would be: public void btCalcularIMC(View v) { float altura, peso, imc; altura =… 
- 
		0 votes1 answer27 viewsA: Problem when trying to make a constant subtraction in Android StudioYou do not need to initialize the Textviews always in the action of the button, both them as hppaladino and hpquimera within onCreate. The way you’re doing every time you click the button hppaladin… 
- 
		1 votes1 answer53 viewsA: How do you pass an activity value to a fragment?I will give you the method that is to pass as argument. There are other methods of communication through Listener or Viewmodel. Finally, create a new fragment already with the constructor… 
- 
		2 votes1 answer179 viewsA: Loop on an Object with an array variableFrom what I understand, you are creating an array with only 1 object always. Place produtosList = new ArrayList<>(); before your second loop, this way you create a product list when you go… 
- 
		1 votes1 answer121 viewsA: Problem reading json in Android StudioThe problem is the type of connection you are making. According to documentation, from Android 9 (API 28 level), plain text compatibility is disabled by default. Solution 1: Try modifying the http… androidanswered Murillo Comino 1,133
- 
		3 votes1 answer48 viewsA: getWindow() command is not recognizedThis problem may occur sometimes and as you are calling a method that is compatible with Appcompatactivity and is not going, the problem may be in the cache of android studio. What you can do is the… 
- 
		1 votes1 answer251 viewsA: webview inside Fragnent I want to open my site inside the webview, and the links inside the site should open outsideFollowing the way you implemented webview instead of: webView.setWebViewClient(new WebViewClient()); the right is to instantiate the class you created that extends Webviewclient, then it would be:… 
- 
		3 votes1 answer116 viewsA: anuncio admob no Fragment android studioFor admob to appear in the app, it first has to be posted in the play store for a few days. The main problem I identified is that you are using the same ID in the manifest as in the banner in… 
- 
		1 votes1 answer146 viewsA: Placing findViewById on the fragmentTo call the webview within your fragment, before the webview has to be in the same fragment xml file. Inside the method onCreate do: @Override public View onCreateView(LayoutInflater inflater,… 
- 
		0 votes1 answer27 viewsA: How to change to property android:fontFamily="casual" in a textView dynamically?It’s simple, do the following: Typeface tf = Typeface.create("casual", Typeface.NORMAL); text1.setTypeface(tf); where text1 is yours TextView, "casual" is the font you want. I hope I’ve helped.… 
- 
		0 votes1 answer55 viewsA: Dynamically pick up colorOr you can transform val cor = "R.color." + cores.get(position) in one piece. or ideally use the following method: getResources().getIdentifier("name", "resource", "package"); In your case I would… 
- 
		-1 votes1 answer90 viewsA: Help me in a logic to solve my problemThere are probably better solutions than this, but this one addresses the problem. create a method to facilitate: private void setText(EditText editText, String value) { //recupera a string do… 
- 
		0 votes1 answer87 viewsQ: Check Internet status on API 29 (Anroid Q)Good afternoon, I have the following method to check if the internet network is active at that time: public static boolean isNetworkAvaliable(Context ctx) { ConnectivityManager connectivityManager =… 
- 
		1 votes1 answer171 viewsA: How to change an image dynamically when a button is pressed and save the state of that imageYou can use Sharedpreferences to save user information to do the following: First within your Activity declare: private SharedPreferences sharedPreferences; private boolean statusOff; public static… 
- 
		0 votes1 answer54 viewsA: Asynktask does not run doInBackGroundHello, from what I understand you are wanting to debug inside theInBackground, so first add in theInBackground right at the beginning: if(android.os.Debug.isDebuggerConnected())… 
- 
		0 votes1 answer42 viewsA: Android - Sharedpreferences - App Update [Doubt]Then she will be saved yes, but there may be some unknown error and she will not be saved. With me this never occurred on new Pis. You have to take into account the same package name, and also the… androidanswered Murillo Comino 1,133
- 
		2 votes1 answer64 viewsA: How to use Sharedpreferences from Android in this case?The error I have identified is that you are initiating Bostone value as false, and this does not change throughout the cycle. So what you need to do is change the initialization of your Boolean… 
- 
		0 votes2 answers109 viewsA: How can I view BD (Mysql) images(url) in Android StudioUse library to do this, make it easy. First add the library in build.Radle(app): implementation group: 'com.github.bumptech.glide', name: 'glide', version: '4.9.0' Inside your Adapter instead of… 
- 
		1 votes1 answer187 viewsA: How to open an Activity when you don’t have internet?I made some changes and tested on an API 24, it worked well. First create an Asynctask extended class, as follows: public class CarregaPagina extends AsyncTask<String, Void, Boolean> {… 
- 
		2 votes1 answer368 viewsA: Update Listview with notifyDataSetChanged()On your Adapter inside the Onclick leave the following: itemposicao.setDescricao(itemposicao.getDescricao()); itemposicao.setCategoria(itemposicao.getCategoria());… 
- 
		2 votes1 answer254 viewsA: Android app does not access API on the latest SDK(28) - Android StudioTry to do the following, inside your Manifest in add application: android:usesCleartextTraffic="true" This allows all HTTP requests 
- 
		2 votes3 answers165 viewsA: Why authenticate your cell phone number via text in the register?Hello, this issue can cause divergences in the answers, since there are those who think that sending sms to authenticate does not have security, others think it is safe. To recover the phone number… 
- 
		0 votes2 answers355 viewsA: Validate Edittext within AlertdialogHello, to treat a button click event in alertdialog, without it close, call the método setOnShowListener (new DialogInterface.OnShowLister); In this method you retrieve the Positive button to handle… 
- 
		0 votes1 answer626 viewsA: How to change the font and color of the navigation Drawer side menuFirst, go to res/values/Styles and create the following themes For your Navigation items: <style name="NavigationItemAppearance"> <item name="android:textColor">#8BC34A</item>… 
- 
		0 votes1 answer57 viewsA: Admobs/ Adview - Advertisement at the bottomOption 1 - Linear Layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"… 
- 
		2 votes1 answer355 viewsA: Run Html5 inside Webview androidHello, you need to put the permission in the Manifest: <uses-permission android:name="android.permission.INTERNET" /> Still in Manifest, but inside application, add:… 
- 
		1 votes1 answer1551 viewsA: How to make monetary mask on Edit Text AndroidCreate the following class: public class MoneyTextWatcher implements TextWatcher { private final WeakReference<EditText> editTextWeakReference; private final Locale locale =… 
- 
		1 votes1 answer525 viewsA: Create a fullscreem and untitled splashAdd in the manifest where Splashscreen is the following theme: android:theme="@style/Theme.AppCompat.NoActionBar" will look like this: <activity android:name=".SplashActivity"… 
- 
		0 votes1 answer92 viewsA: How to delete an external libraryThis happens because some libraries depend on the "X or newer" version of the Android support libraries. A documented solution, to avoid conflicts is the following, put this at the end of the… 
- 
		1 votes1 answer427 viewsA: How to send data between Activitys without opening another window? Android StudioHello, in your Activity Criacateg, in the button that calls Activity Novacor, do the following: Intent intent = new Intent(getApplication(), NovaCor.class); //inicia a activity desejada, enquanto… 
- 
		0 votes1 answer320 viewsA: Destroy fragment on returnHello, just clear the Backstack, leaving onBackPressed as follows: @Override public void onBackPressed() { DrawerLayout drawer = findViewById(R.id.drawer_layout); //retorna o drawer if… 
- 
		0 votes2 answers236 viewsA: Find out if Activity has been closedI believe the simplest way to function, based on Life Cycle of Activity. is the following: Add the onResume method protected void onResume() { super.onResume(); //Aqui você pode recuperar os dados… 
- 
		1 votes1 answer389 viewsA: How to place a button with static position on the scrollviewI’ll leave 2 methods here The first using Layout with Linearlayout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"… 
- 
		1 votes1 answer206 viewsA: Know the color of Button Android Studio (Java)by your example do the following: ColorDrawable buttonColor = (ColorDrawable) coreshexa.getBackground(); //recupera a cor do botão como inteiro int colorInt = buttonColor.getColor(); //transforma o… 
- 
		0 votes1 answer66 viewsA: Androidstudio - Swap url for image in local project pathHello, the right is to leave project images in the drawable folder and change its nomenclature not to start with number: src/main/res/drawable You can call the images as follows: //adiciona suas… 
- 
		0 votes1 answer394 viewsA: Event onBackPressedHello, you can try the following: public void onBackPressed() { DrawerLayout drawer = findViewById(R.id.drawer_layout); //retorna o drawer if (drawer.isDrawerOpen(GravityCompat.START)) {… 
- 
		0 votes1 answer85 viewsA: I’m not able to take the Edittext value of the aux variable and compare in the ifUnderneath your: for(int s = 0; s < nomesAuxiliares.size(); s++) { contador.add(s, 0); } Place a Watcher for your edittext vitoria.addTextChangedListener(new TextWatcher() { public void… 
- 
		1 votes1 answer125 viewsA: Numberformatexception: Invalid int: "1" I CAN’T CONVERT STRING TO INTEGERSince it is a txt, it is probably receiving some "non-printable" character. Try the following: Integer.parseInt(dadosLinha[0].replaceAll("\\p{C}", "")); Thus will remove those characters that are… 
- 
		3 votes1 answer272 viewsA: Open a calendar in a Alertdialog and save the chosen dateDo the following in the fragment your editText creates a Listener for it and initializes the calendar as follows: seuEditText.setOnClickListener(new View.OnClickListener() { @Override public void… androidanswered Murillo Comino 1,133
- 
		0 votes2 answers169 viewsA: How to change attributes of all project Textviews at runtime?Creates this class that will extend from Textview: public class NewTextView extends AppCompatTextView { private Context context; private String fontFamily; public NewTextView(Context context) {… 
- 
		2 votes2 answers160 viewsA: How to change the size of an Edittext contained in a Alertdialog?Do the following: LayoutParams params = new LayoutParams(50,30); // Largura, Altura EditText editText = new EditText(getApplicationContext()); editText.setPadding (10,10,10,10); // esquerda, cima,… 
- 
		0 votes1 answer24 viewsA: Button in the Spinner reset Mainactivity in a DialogfragmentA simple way that I ended up finding was to remove the resetFilters method in Filterdialogfragment and on the Mainactivity button to instantiate a new Dialogfragment.… 
- 
		0 votes1 answer24 viewsQ: Button in the Spinner reset Mainactivity in a DialogfragmentI have two buttons in Mainactivity, the first opens a custom Dialogfragment with some spinners and the other button resets the spinner of this Dialogfragment. When I click the reset button it calls… 
- 
		0 votes1 answer73 viewsA: How to handle data entered into a fragment of a Tabbed Activity in Android StudioHere is an example of the fragment class you can use: public class seuFragmento extends Fragment { private View view; private Activity activity; public void onAttach(Context context) {… 
- 
		1 votes1 answer418 viewsA: Change text color in a Listview (Android)Do the following. Create in res/layout an Xml named after: simple_list cole: <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1"… 
- 
		0 votes1 answer71 viewsA: How to create a Fragment by clicking a button?In your XML Main, you put your FrameLayout under the Button and within the LinearLayout. And instead of: tx.replace(R.id.formulario_main, new ListaBimestresFragment()); Place:… 
- 
		0 votes1 answer396 viewsA: Smarttablayout : How to use icons on tabs instead of text?Try it this way: Create a class named after TintableImageView and leave like this: public class TintableImageView extends ImageView { private ColorStateList tint; public TintableImageView(Context… 
- 
		0 votes1 answer173 viewsA: Start application when unlocking screen - Android Studio -SOLVEDTry to use it like this: public class BootReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { System.out.println(intent.getAction()); if… androidanswered Murillo Comino 1,133
- 
		2 votes2 answers182 viewsA: Generate random number in a user-given range - Java/AndroidGood evening, you need to recover the values passed in Edittext instead of using: String minString = String.valueOf(minValue); String maxString = String.valueOf(maxValue); Let: String minString =…