Posts by daniel12345smith • 2,120 points
129 posts
-
9
votes2
answers2293
viewsQ: What is the best (fastest) way to read a file from a web server?
I need to read a file on a web server, but when I need to store the content in an array of bytes it is taking too long. Does anyone know a faster way to do this? Follow my code. Thanks in advance.…
-
4
votes1
answer2273
viewsQ: How to avoid floating keyboard?
I’m testing my app on a tablet Samsung and the number keyboard is floating, the keyboard is on top of my application, does anyone know how to disable this in the code? Thank you in advance! Obs: The…
androidasked daniel12345smith 2,120 -
0
votes2
answers444
viewsQ: What is the correct way to call a method from a class that inherits from an Activity?
Because if I instantiate the class with "new" and call the method equal to Java it doesn’t work. I have a class that inherits from an Activity and I needed to use her method in several classes. Does…
-
2
votes2
answers1223
viewsQ: How to get all data from one table based on another table?
I have a countries table and another table with continents that has as FK the id of the countries table and I needed to return all countries of Europe. Can anyone give a help on how to do this?…
-
0
votes2
answers928
viewsQ: How to enable the button next to Android to go to a specific field?
I have a form with 4 Edittexts and when I finished filling the first one and clicking the next I needed to go to the third field. Does anyone know how to set this to the next go to a specific…
androidasked daniel12345smith 2,120 -
1
votes2
answers579
viewsQ: How to convert a date that is in string format in the database when doing a query?
I have a date that is in string format in the database "dd/MM/yyyy" and I needed to return in my query the dates from today. How can I do this conversion in the query to compare with today? Thank…
-
2
votes2
answers387
viewsQ: How to return strings that are in crescent date format in Sqlite?
I took a long and recorded on the bench in this format SimpleDateFormat("dd/MM/yyyy") which is a string and now I need to organize the dates. I tried to use this command but it comes in descending…
-
0
votes3
answers97
viewsA: How to make "Adapter.getItemPosition" take only part of the String and hide the other part when presenting Listview?
Solved the problem guys, got my gambiarra but it worked, now I only get the number of the string adapter.getItem(position).replaceAll("[^0-9]*", ""); But could I hide this number? Present only the…
-
1
votes3
answers97
viewsQ: How to make "Adapter.getItemPosition" take only part of the String and hide the other part when presenting Listview?
I have a listview that returns two strings for each row. The code and the name of a country, I would not like to present the code but I need it for when the user clicks the line take the code and do…
-
1
votes1
answer788
viewsA: How to leave a fixed button at the end of Linearlayout via code (without using xml)?
Place the gravity using setGravity(Gravity.BOTTOM).
androidanswered daniel12345smith 2,120 -
1
votes1
answer788
viewsQ: How to leave a fixed button at the end of Linearlayout via code (without using xml)?
I got a linearLayout, and I put it like MATCHPARENT to occupy the entire screen of the tablet, however I needed to leave a fixed button at the end of the screen. Does anyone know how to do this?…
androidasked daniel12345smith 2,120 -
0
votes1
answer2195
viewsQ: How to go back to an Activity already created without recreating it again?
I know that activities on Android are stored as a stack. But I needed to use the button onBackPressed() and go back there are 2 screens behind without recreating this screen. With the Intent it…
androidasked daniel12345smith 2,120 -
1
votes1
answer95
viewsQ: How to add multiple numbers in Sharedpreferences and always keep the instance of Sharedpreferences?
I needed to add a data in Sharedpreferences and it will wipe out all the data, not "zero" plus my data. I am using the editor.putStringSet("data", dado); to store my data, I needed to keep this data…
-
1
votes2
answers199
viewsQ: I’m not able to exbir a listview that uses an Arrayadapter<String>
I have a main class that inherits from Activity where I have my views, but I needed to create another class that inherits Arrayadapter. However I am not able to present my listview, the strange…
-
2
votes1
answer91
viewsQ: How to pass the contents of a String (which I took from View.toString() to a View?
I used "View.toString" to take the contents of a string and save in Sharedpreferences, since I need to save the view inside and Sharedpreferences only accepts primitive type, but now I need to set…
androidasked daniel12345smith 2,120 -
1
votes1
answer88
viewsQ: How to display a listview with only one line with the color changed?
It may seem easy but I’m getting it. I needed in a list of 10 names, to present for example the third name in green color. As I do to get his position, I’m not getting it, I need to present this…
androidasked daniel12345smith 2,120 -
0
votes1
answer163
viewsA: How to put the weight percentage of 2 Edittext fields via code without using xml?
I got it solved! Follow the code: LinearLayout.LayoutParams lp1 = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.7f); 0.7 é a porcentagem, coloquei 0.3 para a idade…
-
0
votes1
answer163
viewsQ: How to put the weight percentage of 2 Edittext fields via code without using xml?
I have two Editext fields, name and age I need the name field to be 70% of the line and the age to 30%, in xml it’s easy to solve this, but in Java code I’m not getting, does anyone know how to do?…
-
3
votes1
answer570
viewsQ: How to place Edittext next to Edit Text dynamically?
I am creating a dynamic form and needed to display in a form, Age and Address on the same line. I created a "for" to create n times the same form but is giving error. follow the code: public void…
androidasked daniel12345smith 2,120 -
0
votes1
answer45
viewsQ: How to keep the colors of items that had the colors changed from listview on Android?
I have a listview, and when I click on a list item it changes color, I needed to keep this color even after the list Activity was called again. Is it possible to do this without having to engrave…
androidasked daniel12345smith 2,120 -
1
votes1
answer3806
viewsQ: Does anyone know a program to decompile an apk and get the source code?
I used 7zip, but it does not decompile the code that is what matters, it decompiles only the xml files. Does anyone know of a program that does this? I thank you in advance!…
-
1
votes2
answers107
viewsQ: How to prevent an Activity from being created again? Is calling it once?
I am making a form and when I finish filling the form I need to change the color of the item of a Listview with the name of the form I just filled and leave the color there independently if I am…
androidasked daniel12345smith 2,120 -
3
votes1
answer4547
viewsQ: How do I block the back button (that little arrow on the hardware)?
I need to block that arrow so that the user does not come back, anyone knows how? Thanks in advance.
androidasked daniel12345smith 2,120 -
0
votes1
answer68
viewsQ: Is there something wrong with this code that sends a String to the server?
Because it is giving nullPointerException. I use Outputstream even to send to the server? public void envia(String minhastring) { HttpURLConnection conn = null; URL url = null; try { url = new URL(…
-
0
votes2
answers2831
viewsQ: How to inflate a button inside a Listview Item?
I need to put a button inside an item of a Listview to match the image below: But I’m doing everything dynamically, I get an array of data from the database and fill in the Listview lines. Does…
androidasked daniel12345smith 2,120 -
4
votes1
answer10348
viewsQ: How to create a txt file?
In Java I use the PrintWriter and works perfectly, but on Android I’m getting a lot, it doesn’t work at all. Can someone help me with this? It’s a simple thing, but I’m stuck. I needed to create a…
androidasked daniel12345smith 2,120 -
1
votes1
answer50
viewsQ: What is the correct way to put the address inside the Path?
Because I am unable to locate my.txt file. Follow the code: public void criatxt() { String texto = "XXX"; try { String filePath = this.getFilesDir().getPath().toString() + "/meuarquivo.txt"; File f…
androidasked daniel12345smith 2,120 -
1
votes0
answers28
viewsQ: Printwriter does not work on Android?
I’m trying to run this code, but it doesn’t work, from the error in Try{}, in Java it works perfectly. public void criatxt(){ String texto = "XXX"; try{ PrintWriter arq = new…
androidasked daniel12345smith 2,120 -
1
votes2
answers37
viewsQ: How to change the color of an item or of the entire Backgroud of a listView by onActivityResult?
It seems I can only change the color of an item in onItemClick() and the full background color when populated ListView. Does anyone know how to do that? What I needed was to click on an item from…
androidasked daniel12345smith 2,120 -
2
votes3
answers57
viewsQ: How to prevent the user to enter a "." point before any number?
I’m using the TextWatcher to make other changes, but I’m stuck on this part, I’m taking a value double and using it for various calculations so I cannot receive the value ". 55" for example. If I…
androidasked daniel12345smith 2,120 -
1
votes2
answers132
viewsQ: How to get the reference of a dynamically created Edittext when you click it?
I created some Textviews and Edittexts dynamically as in the code below: public void criaForm(){ for (int i = 0; i < vet.length; i++) { TextView tv = new TextView(this); tv.setText(paises[i])…
androidasked daniel12345smith 2,120 -
2
votes2
answers97
viewsQ: How to differentiate an Edittext with the same name and the same id?
public void criaForm(){ for (int i = 0; i < 5; i++) { EditText et = new EditText(this); linearLayout.addView(et); TextView tv = new TextView(this); linearLayout.addView(tv); } } I created several…
androidasked daniel12345smith 2,120 -
1
votes1
answer101
viewsQ: List changes color at wrong position
I made a method for when I click on a listview item it change color. The problem is that it also changes color all items that have a range of 12 items of the item I clicked. For example: I have a…
-
1
votes1
answer31
viewsQ: How to put a background color on a Shapedrawable?
It seems to be something very simple, but I’m only able to put the color of the border, someone knows? Follow the code I’m using: public void borda(View view) { float[] outerR = new float[] {10, 10,…
androidasked daniel12345smith 2,120 -
1
votes1
answer209
viewsQ: How to send a string to a web server?
I need to send a string to a server, which in case will be a page of my site. I need to send a txt with the string there, just that. Does anyone know how to do this on Android in the simplest way…
-
1
votes1
answer96
viewsQ: How to prepare a Java object to be sent (with values)?
I have to send a serialized Java object, I already have this method that receives an object and sends, my doubt is how to set the values in the object, my data are in the database, just I take the…
javaasked daniel12345smith 2,120 -
2
votes1
answer151
viewsQ: How to send a die to an already created Activity?
I’m in the Activity A and I sent you a note from putExtras() to the Activity B that has not yet been created, in this case it worked, but now I have to send a data from Activity B to the Activity A…
-
0
votes2
answers64
viewsQ: How to store different ids for Edittexts with the same name?
I have an interaction and within it create several EditText dynamically, but how to keep the id for each EditText? My code: for (int j = 0; j < vet.length; j++) { EditText nome = new…
androidasked daniel12345smith 2,120 -
1
votes1
answer1487
viewsQ: How to set a text based on the Edittext id and not the Edittext name?
when I set a text in an Edittext I do so. EditText edit = new EditText(this); edit.setId(0+4); edit.setText("Meu Texto"); But I would like to set the text by id because in my case I have several…
androidasked daniel12345smith 2,120 -
1
votes2
answers205
viewsQ: How to display the result of an operation in Android?
I own 3 EditText. In the first I put the quantity and in the second a value. I needed that on the 3rd EditText instantly present the result of the operation. You can do this on Android without using…
androidasked daniel12345smith 2,120 -
1
votes3
answers101
viewsQ: Is it possible to put Abels in Listview?
I have several ListView's that I use for browsing, and put as content id's. So, a list that should present country names, is showing the country id. Is there any way to keep those id's list but…
-
1
votes0
answers94
viewsQ: How to take the value of an id that is incremental and use it as a foreign key without using set/get?
I have a Primary key and needed to use it in another table like FK, how do I insert into the bank in a way that does not need to use the set or get modifiers?
-
3
votes1
answer97
viewsQ: How to display in Listview a single query data that returns two data?
I have a query that returns a person’s name and surname. With the result of this query, I enter the information within a ListView and displays the name and surname. How do I display only the name?…
-
5
votes2
answers599
viewsQ: What are the names of the Tabs (Tabs) that are being used in the new apps?
It is a tab that when you slide the contents of Tab to the side goes to the new tab. In the new Youtube update they implemented this and I wanted to know the name to implement in my app. Youtube tab…
androidasked daniel12345smith 2,120 -
0
votes1
answer65
viewsQ: How to take another dice instead of the String that was clicked in Listview?
I have a list of countries of the type Listview, and when I click in Brazil I get the String "Brasil" with the "getItem(position)" but instead I would like to take another data, in the case the "BR"…
-
3
votes1
answer726
viewsQ: How to click on a Listview item and open an Activity reference to the item I clicked on?
I have a listview that has as content a list with country names recorded in the bank (Sqlite). I needed to click for example on Item Brazil, and open another Listview with the states of Brazil, I’ve…
-
2
votes1
answer3167
viewsQ: How to add an edge to a Textview per code?
I am making a dynamic form and would like to add an embroidery around a set with a Textview and an Edittext as in the code below: TextView tv = new TextView(this); tv.setText(vet[0]); EditText et =…
-
3
votes2
answers83
viewsQ: Why every time I turn my Android phone vertical it runs again?
When I’m making an app I usually put some print messages to know what’s going on, but I realized that when I’m running the app and it shifts from vertical to landscape print everything back on…
androidasked daniel12345smith 2,120 -
1
votes1
answer2186
viewsQ: How to release the data that are in the "date" folder of Android phone?
I’m making an app where I create the forms from database data, but nothing is appearing on my phone can only view in AVD, how do I release it?
-
1
votes0
answers27
viewsQ: A "extends Tabactivity" class cannot instantiate methods from other classes?
I made some tabs via java code and needed to receive a method from another class that would return an array, scan the array and fill my tabs, but from the error of "Nullpointerexception" and when I…