Posts by ramaral • 44,197 points
1,060 posts
-
3
votes3
answers604
viewsA: High-box text button in Android API < 14
Use the Appcompatbutton. Appendage xmlns:app="http://schemas.android.com/apk/res-auto" to the root layout and declare the button so: <android.support.v7.widget.AppCompatButton…
-
1
votes1
answer618
viewsA: Permission denied when accessing gallery image
Your code is very confusing, I think you never get the permission. When your "dialog" opens and the user chooses "OK" you have to re-ask for permission. Create a method to ask for permission:…
-
7
votes2
answers101
viewsA: Like warping a button?
A simple way is to respond to the event Paint from the button, draw the desired shape there and assign it to the property Region button. Example for a circular button(source) //Este método…
-
4
votes2
answers1280
viewsA: The location obtained by getLastLocation() always returns null
Although its implementation is minimal, to get the location I think only need call mapGoogleApiClient.connect(). I do the overrun of the methods onStart() and onStop() thus: @Override public void…
-
1
votes1
answer119
viewsA: Error java.lang.Nosuchmethoderogate: Mainactivity.checkSelfPermission
The method checkSelfPermission(String permission) there is no. The method is declared in the class Contextcompat, from which descends Activitycompat, with two parameters: checkSelfPermission(Context…
-
2
votes2
answers1681
viewsA: C# - Reference a variable from another method
From what I understand of your code, what you intend is, in a class(Wk_updatealvo) access a method(Base64Decode()) otherworldly(Allmethods). The code is already calling this method on the line…
-
15
votes2
answers6108
viewsA: Random draw, but with different odds
Generate a random number x : x [1,100]. If x [ 1,30] - caught a blue ball if x [31.40] - caught a red ball if x [41.45] - caught a golden ball if x [46.75] - caught a black ball if x [76,100] -…
-
3
votes1
answer126
viewsA: Design material properties do not appear in API 19 appliance
With regard to the "Material Design" not everything is supported by appcompat. In the case of elevation, it is only partially implemented. To appcompat allows the use of the property, but it is not…
-
7
votes2
answers649
viewsA: Delete files created more than 10 days ago, saving the latest if everyone from the list has more than 10 days of creation
After having the files in an array: make your order in descending order of the modification date check if the modification date of the first item is more than 10 days old if yes, go through the…
-
2
votes2
answers424
viewsA: Deserialize Json in which the key is a number
Used a Jsonconverter it is possible to deserialize this json on a property of the type Dictionary<string,string> or in a List<Item>, with class Item stated in this way: public class Item…
-
2
votes1
answer1332
viewsA: Doubts regarding the use of the camera, via Intent
The camera app is not allowed to record on Storage of its application. But it can(See note) engrave on the Sxternal assigned to its application. Files recorded in this area will be deleted when your…
-
2
votes1
answer86
viewsA: It takes a long time to get results, even with Asynctask’s in parallel
You say you’re running several Asynctask parallel but not true. As Asynctask, by default, are run in series on the same thread, even if they are different. In order for the execution to be done in…
-
1
votes1
answer57
viewsA: Listactivity error, probably related to Onitemclicklistener
I see at least 3 problems in the code: 1 - The ListView list is being initialized outside the method onCreate(). 2 - It is necessary to call the method setContentView(), should your layout not just…
-
2
votes2
answers351
viewsA: Error returning Android Cursor
When using a cursor you should first test if it is not null and then test if you have records at the same time you move it to the first. On the other hand, the resulting cursor of String sql1 =…
-
1
votes1
answer353
viewsA: How to deserialize a list with items of type { "key": "value" }?
The simplest way is to declare the type that will receive the list as List<Map<String, String>>. This is because the Gson considers the rating "chave": "valor" as an input into a…
-
7
votes6
answers3996
viewsA: Check if Edittext is empty
The mistake happens because you are trying to get one Double of a string that is null or has no convertible value. Change the code so that validation of Edittext before obtaining the values in…
-
10
votes3
answers1491
viewsA: Is it good practice to use composite keys as the primary key?
The primary key has two main functions: Unambiguously identify a table record To be used in defining relationships between tables. Although a simple primary key or a composite key serves this…
-
9
votes2
answers864
viewsA: Differences between Jagged Array and Multidimensional Array in c#?
The cast is not possible because int[][][] and int[,,,] declare arrays different. int[][][] is a array of arrays of arrays(Jagged array). Each element of the first array is a array which in turn has…
-
3
votes1
answer6619
viewsA: Button with image and text
You can add an image to a button using the following attributes: android:drawableLeft android:drawableRight android:drawableTop android:drawableBottom Example to place an image positioned on the…
-
4
votes1
answer203
viewsA: Error while removing Object from Arraylist
The problem is in that method remove() is overloaded: E remove(int index) - that removes the index-based item. Boolean remove(Object o) - that removes the saved object based item The method get()…
-
4
votes1
answer1983
viewsA: Every image on android should be treated as a bitmap
Every image on android should be treated as a bitmap? Depends. Yes, because Bitmap is the class of choice to work with images whose format represents a map of bits. A map of bits is a bit array that…
-
1
votes1
answer88
viewsA: Mediaplayer.create() stops working after a few sounds
Whenever you use the Mediaplayer should do the release of it after it has finished playing the sound. To be notified of this occurrence implement the interface Oncompletionlistener and pass it on to…
-
2
votes1
answer46
viewsA: Is it possible to have interaction when updating my app?
Is not possible. You will have to wait the next time the application is executed and then do so. The only chance is to have, in another package, one Broadcastreceiver to respond to Intents…
-
5
votes2
answers985
viewsA: Create a property for a bool variable that handles string and int
It is not possible to overload(Overload) property. You have to create a class that encapsulates this behavior, anything like that: public class LogicalValue { public bool Value { get; } public…
-
3
votes2
answers64
viewsA: How to store different ids for Edittexts with the same name?
What’s missing are the Edittext’s, after created, be added to Linearlayout: int x = 1; for (int j = 0; j < vet.length; j++) { EditText nome = new EditText(this); nome.setId(x);…
-
2
votes2
answers33
viewsA: Event listening in a lib
If you want to listen to an event, then create one. A simple way to do this is to define an interface that the "listener" object must implement to be notified when the event occurs. Start with the…
-
3
votes2
answers2999
viewsA: Show/Hide Bookmarks as Zoom on Android map
To Google Maps Android API Utility Library offers, among others, classes for manage groups of bookmarks. Grouping the markers, you can put a large number of markers on a map without making the map…
-
0
votes1
answer397
viewsA: How to download Webview files from the Sdcard if available
You are wearing request.setDestinationInExternalPublicDir() which, as the name implies would be external memory. The problem may be that newer devices may have more than one type of external memory.…
-
2
votes1
answer341
viewsA: Custom Spinner showing Resource and non-text
Short introduction to Spinner. The Spinner is composed of two Views: to Selected item view, that shows the selected item and the drop-down view, where all items are shown and which allows the…
-
1
votes1
answer749
viewsA: Open external links in another browser
I don’t know if there’s any better solution but, all of a sudden, this is the one I can think of. You can use the method shouldOverrideUrlLoading() to intercept the url and check that it is external…
-
1
votes1
answer1265
viewsA: Webview does not open the requested link
You have to get the url of the link that was clicked. This information is passed on Intent which launched its application. If the Action that Intent for Intent.ACTION_VIEW then the url can be…
-
0
votes1
answer60
viewsA: Giving Ctrl + f in webbrowser by code
The class Sendkeys can be used to send key combinations to the application in the foreground. To send Ctrl + f use: SendKeys.Send("^f");…
-
1
votes1
answer122
viewsA: How do I only get links from my domain to open my application?
You have to change the intent-filter, which is found in Manisfest.xml, from Activity that will respond to Intent, for something like this: <intent-filter> <action…
-
0
votes2
answers156
viewsA: Calling an internal class method from outside
To instantiate an inner class outside the class where it was declared, you first need to create an external class instance and use the syntax objectoExterno.new ClasseInterna() to create the…
-
5
votes2
answers3051
viewsA: Popular Spinner with Sqlite Database -
Create a class to represent a gang: public class Turma { private String nome; private int id; public Turma(int id, String nome){ this.id = id; this.nome = nome; } public int getId(){ return id; }…
-
2
votes1
answer53
viewsA: Error launching app and "Run As" menu with no options
There are two reasons for not appearing any option to launch the application: The first, in the zone "Launch history", because the application was never executed. The second, on the menu "Run as",…
-
3
votes1
answer41
viewsA: How to enable "Telephony Actions" in Android Studio?
If you read the documentation DDMS check that the "Emulator Control tab" is no longer supported. Support for these features will be provided directly on Android Emulator…
-
3
votes1
answer39
viewsA: How to delete a SD Card file?
Save the file path after saving and when you want to delete it use: File file = new File(caminhoDoArquivo); file.delete();
-
5
votes2
answers567
viewsA: Constructor with a String and a String array is not working
To instantiate the class Pizza thus declares the second parameter of the constructor as varargs: public class Pizza { public Pizza (String nomeDestaPizza, String... arrayIngredientes) { } } The 3…
-
1
votes1
answer628
viewsA: Spinner does not appear text inside it
The problem is in android:background="#000" which gives the color black to the background. Like android:textColor="#ff0000" has no effect (does not change the color of the text to red). The result…
-
1
votes1
answer565
viewsA: Function to Open Calendarview by clicking on Relayoutlayout
To intercept the "click" on Relativelayout add a OnClickListener() to him: layout = (RelativeLayout) findViewById(R.id.calendar); layout.setOnClickListener(new View.OnClickListener() { @Override…
-
1
votes1
answer176
viewsA: Timertask Error: Looper.prepare() not called
I suppose the problem might be in the method recebemapa() have code that can only be executed on UI thread. If so use the method runOnUiThread() to execute this code: Timer t = new Timer();…
-
4
votes1
answer1064
viewsA: How to change the color of Edittext’s bright cursor?
The Edittext has an attribute that defines the drawable to be used for the cursor. Create the drawable: my_cursor.xml <?xml version="1.0" encoding="utf-8"?> <shape…
-
0
votes1
answer287
viewsA: How to give a list of images the behavior of a Radiogroup?
With the help of two classes it is simple to implement what you want. A class to encapsulate a Imageview with selected/not selected states. She is responsible for guarding the state and the…
-
0
votes2
answers1630
viewsA: Limit image size without cropping
So that the image fits the size of the button, which is determined in this case by the dimensions of the Linearlayout, use the attribute android:scaleType with the guy centerInside. The image will…
-
1
votes1
answer106
viewsA: Alert works immediately if the time is longer than the closed Larm
That’s the expected behaviour of Alarmmanager. The solution is to check, before creating the alarm, whether the time is earlier than the current time and, if yes, to add a day. To facilitate…
-
1
votes2
answers352
viewsA: Display given in textView
getReadableDatabase() is a class method Sqliteopenhelper. I suppose the class Criabanco inherited from it, so you can access that method and execute query, in this way: Cursor cursor =…
-
0
votes1
answer679
viewsA: Notification with Alarm manager
You are creating Pendingintent wrong. Pendingintent is a mechanism that Android uses to allow an external application(Notificationmanager, Alarmmanager and others) use the permissions of your…
-
2
votes1
answer77
viewsA: Why doesn’t the alarm open Activity?
The code is defining a Intent for a Activity: Intent intent = new Intent(context, MainActivity.class); however it is creating a Pendingintent for a Broadcastreceiver: alarmIntent =…
-
2
votes1
answer334
viewsA: Text inside cardview by half
Cardview height is set with 50dp which does not seem to be sufficient for the height of the text. Set the height of Cardview, Relativelayout, and Textview to wrap_content:…