Posts by ramaral • 44,197 points
1,060 posts
-
1
votes2
answers190
viewsA: Vertical Barcode Reader Activation - Zxing
Guidance is imposed by the Activity used to read the code. In her statement, in Manifest.xml, is used android:screenOrientation="sensorLandscape". As this Activity is part of Zxing has no way to…
-
3
votes1
answer69
viewsA: Error: "Could not find Bookmarkcolumns symbol"
The problem is probably that with the "updates", the compileSdkVersion for version 6.0 or later. Version 6.0 removes compatibility with "global bookmarks". Document extract: This version removes…
-
3
votes3
answers814
viewsA: How and when to build an object in valid state?
From time to time I come to this question for a new attempt to build an answer. In all of them I have always encountered the problem of finding a way to cover all the aspects that the question…
-
2
votes1
answer42
viewsA: References to several Edittext
If you want to build an Edittext array, you can do the following: public class Main extends AppCompatActivity { String[] tags = {"edit1", "edit2", "edit3"}; //Um array para guardar os EditText…
-
1
votes2
answers112
viewsA: Capture the moment the mobile screen was lit and when it was deleted
You must create and register a Broadcastreceiver that listens to events Intent.ACTION_SCREEN_OFF and Intent.ACTION_SCREEN_ON. Example: public class ScreenOnOffReceiver extends BroadcastReceiver {…
-
5
votes1
answer479
viewsA: What is the difference between File Uri, Content Uri and Stringpath?
What are: File URI and Content URI sane Uniform Resource Identifier, identify a particular Resource. Path, usually in the form of a string, identifies a path in a "file system(File System)".…
-
2
votes2
answers130
viewsA: The Binding inside a Compositecollection does not work
You invoke that you cannot use Staticresource because Combobox is dynamic. This fact in no way invalidates its use. So that the field itens may be "observable" It has to be property. On the other…
-
2
votes1
answer114
viewsA: Determine the number of items in a list that are within the limits defined in another list
If in the "other list" item 0 is the lower limit and item 1 is the upper limit, the code below builds a list with the values that are within those limits. var lista = new List<int> { 1, 2, 3,…
-
1
votes1
answer177
viewsA: How do I recover a result from within the "onActivityResult" in my Activity
I would like to use the result of "Contents", within my function "clickProducts()", but I’m not getting it. You won’t get. When the button is already clicked the method clickProducts() will have…
-
5
votes1
answer936
viewsA: Make java.sql.Date object to dd/MM/yyyy format
There is no way to change the format, Date has no format. Any Date type/class represents a specific instant in time, with an accuracy of milliseconds. It has no format, represents the number of…
-
1
votes1
answer73
viewsA: Chronometer display value greater than 60 minutes in MM:SS format
By default the value is displayed in the "MM:SS" format, passing to the "H:MM:SS" format when the minute is greater than 59. The class Chronometer provides the method serFormat() however, contrary…
-
4
votes1
answer320
viewsA: Why pass arguments to a Fragment using Bundle instead of a set method
Whatever the situation, it is not "advisable" that the initial state of an object be determined using "setters". "Good practice" states that the initial state of an object must be determined in its…
-
0
votes3
answers842
viewsA: Save state when returning to an Activity
Instead of re-launching the Activity Registrosmaterials, in the method run(), do finish(). public class Finalizando extends Activity { @Override protected void onCreate(Bundle savedInstanceState) {…
-
1
votes1
answer182
viewsA: How to pass a class with Bigdecimal and Date attribute through intents(Bundle)?
Has (at least) two possibilities: Make Minhaclasse implement Serializable, which is not advisable for this purpose(1). Date and Bigdecimal implement Serializable, they will be processed without…
-
1
votes1
answer82
viewsA: Alarmmanager does not run on configured interval
From API 19 all repeating alarms, such as setRepeating(), will be inaccurate, is the same as using setInexactRepeating(). One solution is to use one of the repeating alarms, such as setExact() and…
-
4
votes2
answers894
viewsA: How to exchange/exchange the value of two variables
Has two problems. The way to exchange is wrong as well as the way you use the variables in the printlnalso. Change to: //Guarada o valor de A Aux=VarA; //A variável VarA, como já foi guardado o…
-
7
votes2
answers324
viewsA: When to call super.nameAll when override(override) a method?
When writing a class extending from another it is possible to overwrite your methods. In doing so you are writing another implementation, the original implementation being discarded/overwritten.…
-
2
votes1
answer72
viewsA: How do I restart the app when it’s brought from the background?
If there is no other solution, use a flag to indicate when to do Finish. As I understand it just should not happen when it returns from an Activity launched by her. Declare the flag as an attribute…
-
4
votes1
answer218
viewsA: How to get the device serial number?
According to the documentation must use Build.getSerial(); which returns the hardware serial number, if available. Requires API level 26 and requires permission READ_PHONE_STATE. In previous…
-
2
votes1
answer99
viewsA: How to capture exceptions released by the Insert() method?
The method Insert() captures any launched Sqlexception, making your block try/catch useless with regard to Sqlexception type exceptions. Source code of the method insert(): public long insert(String…
-
0
votes1
answer296
viewsA: Open pdf by URL and Inputstream Pdfview
Instead of "change screen" with setContentView() should use another Activity. From what I understand the PDF view(R.id.pdfView) should be in the layout R.layout.view_pdf and not in the…
-
1
votes2
answers84
viewsA: Data sent from one Activity to another arrives null
What you are to include in Extra is a long, I suppose the Customer ID, not the Customer(object). When trying to do, in Activity Tela_loan, the cast for Client cliente =…
-
0
votes1
answer131
viewsA: Alarmmanager is not repeating
That way the alarm can never launch the Intentservice. You’re building the Pendingintent with PendingIntent.getBroadcast(), which serves to launch Broadcast Receivers. To launch a Service you must…
-
1
votes1
answer77
viewsA: Some libraries do not appear in the dependency search list
By what I am given to understand the search only works for libraries whose identifier begins with com.android or com.google.android. So you need to know the full library identifier to add it. Note…
android-studioanswered ramaral 44,197 -
2
votes1
answer148
views -
2
votes1
answer821
viewsA: Concatenate a @string and XML text
That way it’s not possible. One possible approach is to create a class that inherits from view who intends to use and give you this ability. Start by declaring an attribute to be used in xml. It…
-
4
votes2
answers2528
viewsA: Find Sqlite Database on Android
The reason why subdirectories do not appear in the folder Data is the adb not having permission to read its contents. Use the Device File Explorer. You can open it through View > Windows Tool…
-
1
votes1
answer107
viewsA: Asynctask with one or more methods
Not only in this case but whatever the situation may/should consider other approaches. However it should take into account not the organisation, necessity, preference, or even good practice but…
-
1
votes1
answer41
viewsA: Monitor battery usage in the app itself
Can’t tell how much an app is battery/power consuming(1). However it is possible to know what is the current battery level: IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);…
-
1
votes2
answers275
viewsA: Split a layout into 2 with different percentages
Use Linearlayout and use the attribute android:layout_weight to define, proportionately, the space each View occupies: <LinearLayout android:layout_width="match_parent"…
-
8
votes1
answer171
viewsA: Android - What is the difference between String and Editable?
There are two main differences Mutability Whenever any operation is applied to a String a new one is created, the same does not happen in Editable where the operation is applied in the current…
-
1
votes1
answer424
viewsA: Using executor on android
Don’t use the new. Executors.newSingleThreadExecutor() is a method and not a class. ExecutorService exec = Executors.newSingleThreadExecutor(); Its function is to create an instance of…
-
0
votes2
answers102
viewsA: How to use the Sharedpreferencesutils.java class?
The file name used is the one that the class declaration assigned to the field PREFS_FILE_NAME. If you want to be able to specify another name for the archive you should override the public methods…
-
2
votes1
answer104
viewsA: Pull back from Asynctask class
If you want the result of the task executed by Asynctask to be performed asynchronously then you cannot use the method get(). The method get() obtains the result but causes the execution of the…
-
1
votes1
answer266
viewsA: Get String from strings.xml file
You must use: in an Activity or Service String SQL_CID = getString(R.string.insert_cid); elsewhere, you need to have a Context String SQL_CID = myContext.getString(R.string.insert_cid);…
-
5
votes1
answer77
viewsA: Why do the app files remain after uninstallation?
I don’t think you read the documentation because, contrary to what you say, the files stored in internal storage are deleted after uninstallation of the app. The same goes for external storage if…
-
1
votes2
answers125
viewsA: Google Maps returning Latitude and Longitude as zero and problems when placing the Marker
Adding Marker to map action is only valid/possible after map is ready(onMapReady()) and the location to be obtained(onSuccess()). As both the creation of the map and the obtaining of the location…
-
0
votes1
answer110
viewsA: Error:Failed to resolve: support-Annotations
You have to add to the block dependencies from build.Radle the following dependency: compile 'com.android.support:support-annotations:22.2.1'
-
1
votes1
answer81
viewsA: Difference between android.content and android.support.v4.content
android content. refers to a namespace existing in the Android SDK whose version of the API is that indicated in compileSdkVersion. android.support.v4.content refers to a namespace existing in the…
-
0
votes1
answer189
viewsA: android:textIsSelectable in Webview
Add a Onlongclicklistener to Webview and make the method onLongClick() return true. webnewsdes.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) {…
-
1
votes2
answers435
viewsA: How to focus position using Recyclerview?
Recyclerview does not have these methods. However the Layoutmanager she uses has. You can access them using Parcelable recyclerViewState = recyclerView.getLayoutManager().onSaveInstanceState() and…
-
3
votes1
answer71
viewsA: Recyclerview Android
You’re only treating when item.getImprimir() == true. Recyclerview, when scrolling, reuses used views, they come with attributes with values previously "set". So you have to treat when it’s false:…
-
1
votes1
answer188
viewsA: How to compare name of two images in Android Studio
I suppose when you say "image name" you’re referring to the ID assigned by android:id or setId(), in this case R.id.imageViewId. If so, use the method imagem.getId() to obtain the assigned ID: if…
-
2
votes3
answers2244
viewsA: Position Button in the center of a Linearlayout with layout_gravity
Contrary to popular belief, a Linearlayout, match_parent does not make it occupy all the Parent. The old name, fill_parent, in that sense, it was even worse. So being and wanting to use the…
-
0
votes1
answer67
viewsA: Question ~beginner about 2 android SDK`s on the same pc
You can install Android Studio without any problem. Having two Android Sdk does not cause problems in the functioning of Visual Studio or Android Studio. However, it is preferable that you both work…
-
1
votes2
answers717
viewsA: Call method with View parameter in another method
I suppose this method is used by a Button whose click Listener has been assigned, in its xml declaration, with android:onClick=lista. It seems that you want this method to be called not only when…
-
2
votes1
answer61
viewsA: Calling more than one callback at the same time
The Minhaworkerclass class, as implemented, can only register a callback. In order to register more than one you must store them in an array. public class MinhaWorkerClass { private…
-
6
votes3
answers370
viewsA: Listview with different layouts per line, according to filtered value
Yes it is possible. For this you must have/do: A class that represents each item(Client) with "getters" for each of the values you want to show. A custom Adapter. A layout for each line type. In the…
-
2
votes2
answers89
viewsA: Standard value in Spinner+ generated from the database
You must first add the "Select..." item and then return the method getClientes() using addAll(). public void spinnerClientes() { ControllerClientes ctClientes = new ControllerClientes(this);…
-
2
votes1
answer539
viewsA: how to know the latest version of a Google library (dependency) for Android Studio
As regards the appcompat in Support Library Packages finds the listing of all libraries and their identifier to be used in the Gradle. You can find the lists and details of the most recent revisions…