Posts by Woton Sampaio • 1,461 points
103 posts
- 
		-1 votes1 answer56 viewsQ: Run command - TerminalRemembering that this is not just for this case, I want to create for example . Bats to automate some things, so I would like to know how to make you wait for the return of commands and interpret my… 
- 
		0 votes1 answer94 viewsA: While() loop validation bug?Try to go through the Cursor thus: Cursor c = db.rawQuery("select..."); c.moveToFirst(); for(int i = 0; i < c.getCount(); i++){ String valor = c.getString(c.getColumnIndex("Nome da coluna"));… 
- 
		1 votes3 answers3139 viewsA: Video unavailableTry this: <iframe id="ytplayer" width="280" height="130" src="https://www.youtube.com/embed/7FrswUVAvmA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope;… 
- 
		1 votes1 answer3849 viewsA: How to delete primary key (PK) in Mysql?Run this query to remove the desired column: ALTER TABLE `tabela` DROP `coluna`; I see you’re a beginner in PT Stackoverflow, but is it really necessary to remove the primary key from your table?… 
- 
		3 votes1 answer103 viewsA: How to set a string coming from a sqlite database to display in a Textview?To get the data from Cursor, soon after making the select you should make a: cursor.moveToFirst(); So it will go to the first index, to get the value of that index you do: String texto =… 
- 
		0 votes1 answer311 viewsA: How to convert Jsonarray to Arraylist<> on androidYou can go through the Jsonarray and keep adding the items to your Arraylist ArrayList<DataProvider> data = new ArrayList<DataProvider>(); JSONArray array = new JSONArray(); array =… 
- 
		0 votes1 answer36 viewsA: Best practice to call a new screenThis will depend on what that registration will look like, if it’s something simple like name, value and date, for example, I believe that the Dialog already resolves, now if it is something more… androidanswered Woton Sampaio 1,461
- 
		0 votes1 answer15 viewsA: How to get Width of ImagebuttonI got it here: view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() {… 
- 
		2 votes1 answer15 viewsQ: How to get Width of ImagebuttonHow can I get the width of an Imagebutton defined in XML 0 being defined by weight? <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"… 
- 
		2 votes1 answer228 viewsA: How to resolve a synchronization with the server when there is connection drop on Android?You can do a check every X seconds/min/hour to check for internet, and all that is done you save in your Sqlite and creates a column that loads the default non-synchronized state, when that row is… 
- 
		2 votes1 answer38 viewsQ: Code before or after superWhen screams a method, always comes the super of the parent class, but at the time of coding the right thing to do would be before or after it? In the example below the right would be this:… 
- 
		1 votes2 answers127 viewsA: Android - Edittext does not return typed valueDo it like this: EditText tamanho = findViewById(R.id.tamanho); int tam = Integer.parseInt(tamanho.getText().toString()); That should solve The error from the looks of it, you are not assigning a… 
- 
		0 votes1 answer103 viewsA: How to transition to the previous Fragment when pressing the back button?Do so: Fragment fragment = new MyOtherFragment(); FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.main_container, fragment);… 
- 
		0 votes2 answers29 viewsA: Select database items that contain something similar to the contents of an arrayMount your query like this: $array = array(0 => "valor1", 1 => "valor2", 2 => "valor3", 3 => "valor4"); $query = "SELECT * FROM sua_tabela WHERE"; foreach ($array as $k => $v) {… 
- 
		1 votes2 answers842 viewsA: Sharp word problem from Mysql databaseIn your connection file, do this: Object-oriented mode: $mysqli = new mysqli("host", "user," "senha", "db"); $mysqli->query("SET NAMES 'utf8'"); $mysqli->query('SET… 
- 
		0 votes2 answers47 viewsQ: Total Subrecords - MysqlIn my database I have several tables, but I’ll make a simple example of what I want to do: Assuming two tables: Table 1 id | store | date Table 2 id_2 | id_tab1_2 | product Note that the id_tab1_2… 
- 
		1 votes1 answer43 viewsA: Return an addressDo it this way: public class main extends AppCompatActivity { LocationListener locationListener; LocationManager locationManager; @Override protected void onCreate(Bundle savedInstanceState) {… 
- 
		1 votes3 answers253 viewsA: Comparison between PHP and mysql variablesLook at the example if each id comes from multiple records: if($th = $mysqli->query("SELECT * FORM `sua_tabela`"){ while($row = $th->fetch_assoc()){ if ($rows['block'] == $idBlock ) {/ //Seu… 
- 
		1 votes1 answer202 viewsA: How to insert onCreateOptionsMenu into a Java class?As I said, if you use Fragments, they will all have the parent Activity, in it you implement the 2 methods, if case for each fragment you want them to options have a different function, you can do… androidanswered Woton Sampaio 1,461
- 
		0 votes2 answers625 viewsA: Search in 2 fields at the same timeMaking the explode and assembling your query: //Separo a frase por espaço $v = explode(" ", "palavra 4"); $query = 'SELECT * FROM sua_tabela WHERE '; foreach ($v as $key => $value) { $query .=… 
- 
		0 votes3 answers215 viewsA: Relationship between two tablesTip: I think it would be nicer to add in the second table tbl_games two fields: id_time1 and id_tim2 As foreign keys, imagine that there comes a point of your project that you want to pull… 
- 
		0 votes1 answer72 viewsQ: AUTO_INCREMENT customizedi have in a db MYSQL two tables that are linked: ADMIN id - nome - empresa Each admin adds several values in the Docs table: DOCS id_doc - id_admim_doc - doc - valor The column id_admim_doc is a… 
- 
		0 votes2 answers1029 viewsA: How to delete directory from internal storage on Android?Do so: String path = "caminho da pasta/arquivo, etc"; boolean p = new File(path).delete(); if(p){ Toast.makeText(view.getContext(), "Deletado com sucesso!", Toast.LENGTH_SHORT).show(); }else{… 
- 
		0 votes1 answer188 viewsQ: Maximum size of QrcodeI am implementing in a project a reader and generator of Qrcodes and I came to doubt, how long a Qrcode can store? I could get something around 3 pages of text? qrcodeasked Woton Sampaio 1,461
- 
		0 votes1 answer172 viewsA: Android Studio Doesn’t Recognize Gradle LibrariesIf it runs normally even being like this, go to your Android Studio: Click on "File" Then under "Invalidate caches/ Restart" And finally confirm in "Invalidate and Restart"… 
- 
		3 votes1 answer318 viewsA: Recycleview item returning the same data for all items when clickedTo add a click event to each separate item or you do it here: @Override public void onBindViewHolder(MyViewHolder holder, int position) { DadosSolicitacao dados = solicitacoes.get(position);… 
- 
		0 votes2 answers73 viewsA: taking out the commas and sorting with php mysqlIf it’s multiple records each with multiple numbers separated by comma you do so: $mysqli = new mysqli('host','user','pass','db'); $array = array(); if($th = $mysqli->query("SELECT * FROM… arrayanswered Woton Sampaio 1,461
- 
		1 votes2 answers533 viewsA: Set the first letter of the $variable in uppercaseIf you want to make all words in the sentence capital the first letter, you can also use ucwords: echo ucwords("olá mundo!"); //Sairá: Olá Mundo! 
- 
		1 votes2 answers51 viewsA: How to cut a sentence and put the results in stringsYou can use a replace: $frase = 'tem refrigerante na geladeira'; $pergunta = 'tem'; $local = 'na geladeira'; $output = str_replace($pergunta , "" , $frase); $output = str_replace($local , "",… phpanswered Woton Sampaio 1,461
- 
		0 votes1 answer29 viewsA: Itemclicklistener not availableCreate this class in your project: public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { private OnItemClickListener mListener; public interface OnItemClickListener {… androidanswered Woton Sampaio 1,461
- 
		1 votes1 answer53 viewsA: Drag n Drop - AndroidIn my Myondraglistener, I need to specify the position where to put the new version in my layout. Doing so: View view = (View) event.getLocalState(); RelativeLayout container = (RelativeLayout) v;… 
- 
		0 votes1 answer53 viewsQ: Drag n Drop - AndroidI made a Drag n Drop system, but when I insert the item, it seems that gravity is like top, when inserting new ones, they stand on top of each other, like drop where I drop the finger? The items are… 
- 
		0 votes2 answers653 viewsQ: How the.setOnClickListener(view -> method() item works)How does this item.setOnClickListener(view -> method());? I’ve never seen that kind of call, I saw it today and I was curious about that view, where does it come from? How does this type of call… 
- 
		1 votes1 answer337 viewsA: Recover user name and email in Navigationdrawer?If you’re using the Navigationdrawer the template already provides: NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);… 
- 
		1 votes1 answer79 viewsA: Camera does not workI made it work and you know how? I restarted the phone, and how did I find it? I tried to use Whastapp’s camera function and showed me the message that it was not possible to access the camera at… 
- 
		3 votes1 answer79 viewsQ: Camera does not workI tried to access the camera phone, it worked 3 times, then the screen went black (Print below) in API 24, I tested it on a mobile phone with API 22 and it worked, with API 24 no, someone knows how… 
- 
		1 votes1 answer38 viewsA: Error trying to open map with path disabledTo ask the user to turn on the gps if off do: @Override public void onResume() { super.onResume(); //Pede para ligar o gps caso desligado String provider =… 
- 
		3 votes2 answers866 viewsQ: Compare using String.Contains() disregarding accents and caseI know there’s already question, I even used the same title to call attention, but this one refers to C#, I’m having this problem in java, code: //historico e searchC são ArrayLists, no caso do case… 
- 
		1 votes2 answers2334 viewsA: How to get the input value in real time?You will need js, it will be something like this: $('#iddoinput').keyup(function(){ var text = $(this).val(); alert(text); //Aqui dentro você faz o que quer, manda pra um arquivo php com ajax //ou… 
- 
		1 votes1 answer27 viewsA: Change shadow color of ViewpagerThis color is usually the same as Accent, look in the res folder, in the Styles file, if not, add these lines: <style name="AppTheme" parent="android:Theme.Material"> <!-- Main theme colors… 
- 
		1 votes1 answer1462 viewsA: Dynamically change the image of an imageView (Android Studio)?Make a vector with the images: int[] imagensIds = { R.drawable.image1, R.drawable.image2, R.drawable.image3 }; //E um int para saber qual posição int i = 0; Your image carries the first with the… 
- 
		0 votes2 answers30 viewsA: Component with same heightAn alternative way without using java: <LinearLayout ... android:layout_alignParentTop="true" android:layout_alignBottom="@+id/lista_nome" .../>… 
- 
		1 votes2 answers30 viewsQ: Component with same heightThere is a way to make a Linearlayout to have the same height as a Textview? <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"… 
- 
		0 votes0 answers42 viewsQ: Array x ArraylistYesterday I made a question on how to use a Two-dimensional Array dynamically, so I ended up getting a reply to use a Arraylist, and this served perfectly for my case, however, from that it… 
- 
		1 votes3 answers206 viewsQ: Dynamic Array - AndroidHow to create a dynamic array in this way: //Apenas um exemplo abaixo: String valor0 = "1;2;3;4;5;6;7;8;9;0"; String valor1 = "1;2;3;4;5;6;7;8;9;0"; String valor2 = "1;2;3;4;5;6;7;8;9;0"; //Um array… 
- 
		0 votes1 answer413 viewsA: How do I set a value in Edittext if empty?Do it like this: EditText edit = (EditText)findViewByid(R.id.edit); //estabeleço o conexão if(edit.getText().toString().isEmpty()){ // verificando se a edit esta vazia String num = "6"; // Ou use um… androidanswered Woton Sampaio 1,461
- 
		1 votes1 answer57 viewsA: How to take the return of this methodFinally got it, I changed the method and the class, it was like this: public class Inflate{ private static final String FRAG_TAG_DATE_PICKER = "fragment_date_picker_name"; public void… 
- 
		1 votes1 answer57 viewsQ: How to take the return of this methodI’m using the lib betterpickers, I tried to make a class to take your information form OO, however the method does not have a return, it is a void, there is a way to catch this return? public class… 
- 
		0 votes3 answers963 viewsA: store the value of a query in a php variableIf you’re trying to give a: echo totalEspumas(); It’s wrong, since it returns an array, the right one would be: $var = totalEspumas(); echo $var[seu_index]; If you want to see everything in the… 
- 
		0 votes1 answer72 viewsQ: Very large array - AndroidWhich ones problems I could face in the manipulation of arrays many a great? When I say arrays I mean at least 25, each containing +of 1000 index. Performance: Would my application’s performance be…