Posts by Márcio Oliveira • 2,237 points
129 posts
- 
		0 votes2 answers21 viewsA: What is this error "D/TAG: Return...: [Lcom.example.Gustavo.domanda.Consultarpojo;@11c78941"You are trying to concatenate a direct string ("Return...") into the log with an Object Array (Sponse). It’s no mistake, it just took the "header" that describes the Array. If you want to take a… androidanswered Márcio Oliveira 2,237
- 
		3 votes3 answers1479 viewsA: What is this "Could not find method schedule(View) in" error?You must have used in the XML button "Schedule" the attribute onClick pointing to the method agendar(). For this to work this way, the method has to be declared that way in Java: public void… 
- 
		1 votes1 answer35 viewsA: Problems with xml in different screen sizesThe folder you have to create is res\layout-small and not res\layout\layout-small Following is Google’s official tutorial on how to design for various screen sizes:… 
- 
		0 votes4 answers1125 viewsA: Loading an externally created Sqlite databaseNatively you cannot import a pre-loaded SQL database. The options are: 1) Do a base reverse to generate the DDL (script with the Inserts) and use it in your application’s Helper when creating the… 
- 
		1 votes1 answer261 viewsA: Insert picture into empty listview backgroundYou don’t have to do any of this. Just use the method setEmptyView() of Listview pointed to a View or Viewgroup of any XML Layout and this will be automatically loaded when the list is empty. Ex:… 
- 
		1 votes1 answer246 viewsA: Disable checkbox in RecyclerviewI did something similar in a project of mine using Radio Button, which I believe is also the most appropriate for your case (checkboxes imply more than one selection). I’ll put the code to my… 
- 
		3 votes1 answer157 viewsA: How to identify that the application has stopped working?The best way is to identify the most sensitive crash points in your app and treat them with Try/catch blocks, so you can save data at these points. try{ // Executa código "sensível" a travamentos }… androidanswered Márcio Oliveira 2,237
- 
		1 votes3 answers883 viewsA: Validate whether INSERT was successfully executed or not (JTDS)You can change the execute() for executeUpdate() and test the return value. According to official documentation: int executeUpdate() throws Sqlexception Executes the SQL statement in this… 
- 
		1 votes2 answers380 viewsA: How to assign data from an object to editText on Android?In the section you left commented, after declaring Edittext edtCep, just switch to this command: edtCep.setText(obj.optString("cep"), TextView.BufferType.EDITABLE); androidanswered Márcio Oliveira 2,237
- 
		1 votes1 answer88 viewsA: Error Search View in Custom AdapterInvert these lines in onCreate: setupSearchView(); mSearchView=(SearchView) findViewById(R.id.search15); Thus remaining: mSearchView=(SearchView) findViewById(R.id.search15); setupSearchView();… 
- 
		0 votes1 answer77 viewsA: Do I need to add all ads to the.xml string?Each ad has its own id, so.xml strings have to have items with different names to represent each id (because it’s not even possible to have any 2 items in XML with the same name). On the other hand,… 
- 
		0 votes2 answers1048 viewsA: Bringing a sum in Sqlite AndroidJust fix that line: String total = stmt.getColumnName(0).toString(); For: String total = stmt.getString(0); stmt.close(); 
- 
		2 votes1 answer55 viewsA: I cannot pass the URL of a downloadable pdf file without a static variableYou are passing the link in the Intent with the name "link_file" and recovering the Extra using another name ,"link", soon it will be null. The names have to be the same. EDIT: The parameter passed… androidanswered Márcio Oliveira 2,237
- 
		1 votes1 answer22 viewsA: Good practices with Android comic bookThe way you’re doing it is great. I believe you should also implement a Contentprovider, so specifying the access Urls for each table in the Contract is a good one. All you need is a contract file.… androidanswered Márcio Oliveira 2,237
- 
		0 votes1 answer69 viewsA: How to use an image in android application that is saved on a web server?Just use libraries like Glide or Picasso. Ex (Glide): Add these dependencies to your file app/build.gradle: dependencies { compile 'com.github.bumptech.glide:glide:4.0.0' compile… 
- 
		1 votes1 answer443 viewsA: Android Studio, CRUD in SQL Server 2008You are not using Asynctask correctly. 1) Does not have a method onPostExecute() that receives the return value of the method doInBackground() to at least make Progressbar disappear or show some… 
- 
		0 votes1 answer133 viewsA: Linearlayout over a listviewOnly set it last within Relativelayout, ie move pro end of code. In Relativelayout or Framelayout the views are being "stacked" according to the order in which they are defined, that is, the last… 
- 
		0 votes1 answer384 viewsA: Gradle project refresh failed - Cause: invalid stream header: FFFFFFFFProbably your Gradle files have corrupted. Try these steps: 1) File -> Invalidate Cache 2) Delete the folder .gradle of your project 3) Rebuild the project… 
- 
		0 votes1 answer38 viewsA: I can’t fix the bug with adUnitIdIn the archive res/values/strings.xml you have to create an item with this id: <resources> <string name="banner_ad_unit_id">código do unit ID do seu ad</item> </resources>… androidanswered Márcio Oliveira 2,237
- 
		0 votes1 answer378 viewsA: Recover Contact List Name List on an android EditThe column of ContactsContract that you should use to recover the name is this: ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME Then you can try to do as it was already encoded before: protected… 
- 
		0 votes1 answer120 viewsA: I think my table is not being created : no such table?Your variable Carros.TABELA_CARROS has value "cars" and the table you create is called "Cars". Why don’t you use these constants in the table and column creation strings? Avoid this kind of problem.… 
- 
		0 votes1 answer262 viewsA: Textview Imageview Constraintlayout AndroidNum ConstraintLayout views need to be "anchored" to each other and in your case are not. The easiest way to do this is by the visual editor of Android Studio where you select a view, drag a point… 
- 
		2 votes1 answer74 viewsA: Mathematical operation onBindViewHolderIt is giving error because in the method setText, if you pass an integer value, it understands that it is to take the value of a Resource with that id (which probably won’t exist, so the error). If… 
- 
		0 votes1 answer180 viewsA: Android Testing InstrumentalsI believe you’ve declared your test class wrong and the right thing would be this: @RunWith(AndroidJUnit4.class) @LargeTest public class MainActivityTest { @Rule public… 
- 
		2 votes1 answer213 viewsA: Using database coordinates in google maps APIThe Loader returns the data asynchronously, so it probably initializes your map before the Loader returns with the results. Try initializing the map within the onLoadFinished() method of the Loader,… 
- 
		0 votes1 answer466 viewsA: How to search within a Recycleview?How do you store the data in a ArrayList<Upload>, create a method that finds what you want in this Array (can be a loop with an internal if) and return the position of it. Ex: public int… 
- 
		1 votes1 answer70 viewsA: java.lang.Unsupportedoperationexception: Can’t Convert to Dimension: type=0x12In your Edittext, remove attributes android:layout_marginEnd="@+id/guidelineDireita" and android:layout_marginStart="@+id/guidelineEsquerda" <EditText android:id="@+id/campoNomeId"… 
- 
		1 votes1 answer42 viewsA: Not deleting from the Database the data I wantIf you set the column to TEXT, then the problem is that it lacked plics (') in the comparison parameter of your SQL query. It should be yes: String query = "DELETE FROM " + TABLE_NAME+ " WHERE "+… 
- 
		0 votes3 answers303 viewsA: When I roll my listview I miss checkboxes markedAssuming that the amount of items in your Listview will not vary in size, then to simplify, you can create a static 2-dimensional Boolean array in your Adapter. Ex: private static boolean [][]… 
- 
		1 votes2 answers72 viewsA: How to recover value of an integer and set in a alertDialogNothing appears because you are setting the Dialog text with the variable ResultadoA before it has any value. androidanswered Márcio Oliveira 2,237
- 
		1 votes1 answer102 viewsA: Loop of random numbersI believe the Arraylist teste has to stay out of the method geraSix, for it not to be constantly initialized (and lose the previous values), that is, its Gerasix method only adds strings in this… 
- 
		0 votes1 answer90 viewsA: Sending data to MYSQL database with PHPJust pass the id as a string. hashMap.put("id", "" + cliente.getId()); 
- 
		1 votes1 answer559 viewsA: Notification on Android does not disappear from the notification barIn these 2 services you call with the notification intents, there has to be a method that cleans the notification after receiving the notification Action. Something like that: public void… 
- 
		1 votes1 answer64 viewsA: wrap_content is not workingThe wrap_content in Imageviews only works if the image is already of known size, since the layout is inflated as soon as the Activity starts. And in your case your image will still be uploaded from… 
- 
		1 votes1 answer513 viewsA: Static, private and final variablesFinal variables are only constant, meaning they cannot receive new values. Static variables are class variables, that is, they do not depend on the creation of an object to be used and all objects… 
- 
		1 votes1 answer76 viewsA: Fragments does not disappearTry trading your XML for: <FrameLayout android:id="@+id/fragments" android:layout_width="match_parent" android:layout_height="match_parent" /> The element fragment in XML is to load a single… 
- 
		2 votes1 answer874 viewsA: Pass Database values to SpinnerCreate a class Cliente, with the variables id and nome and go storing the json data in a ArrayList<Cliente> Ex: public class Cliente { private int mId; private String mName; public Cliente(int… 
- 
		2 votes2 answers27 viewsA: I can’t add items to scroolviewIn the code snippet below, change the RelativeLayout for LinearLayout, swap the1000sp for wrap_content and add a android:orientation="vertical": <RelativeLayout… 
- 
		3 votes3 answers308 viewsA: Data Json on androidThe error happens because the variable resposta is null and the method Log requires a valid value to print something in Logcat. And its variable is null because you try to assign a value to it with… 
- 
		0 votes1 answer363 viewsA: How to do date validation?You can try something like this: String dataDigitadaStr = editText.getText().toString(); // Ex: "04/05/2010" SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy"); Date dataDigitada=… 
- 
		1 votes1 answer38 viewsA: Monitor changes in the applicationMy suggestion is to create possible completion "states" (ok, error, etc.), or any other change that you want to monitor, that an external service can generate in execution and make the service store… 
- 
		3 votes1 answer57 viewsA: Limit recording time (Mediarecorder)Just use the native method setMaxDuration of MediaRecorder when you set your object. In your case: mRecorder.setMaxDuration(60000); According to official documentation: void setMaxDuration(int… androidanswered Márcio Oliveira 2,237
- 
		2 votes1 answer59 viewsA: How to improve the performance of an Android appThe method you choose to use to upload data from a web service to a background thread will not influence performance. Regarding the loss of work done, this is characteristic of Asynctask which is… androidanswered Márcio Oliveira 2,237
- 
		0 votes1 answer367 viewsA: Attempt to invoke virtual method 'voidWhat is null is its object repoResultado. You must not have initialized it. Hence it gives the null reference error when trying to call the method deletar of that class.… 
- 
		2 votes2 answers1248 viewsA: How to catch the return of the method ofInBackground on android?The method doInBackground passes the result to another Asynctask method, the onPostExecute. In your case, if Asynctask is created in Activity itself, you could assign the value of usuario within it:… 
- 
		1 votes1 answer250 viewsA: Relativelayout "anchored" at the bottom of the screenI believe you only need to set one layout_height other than match_parent and use this attribute: android:layout_alignParentBottom="true" To hide/unhook do not need to move height, only use these… 
- 
		2 votes1 answer27 viewsA: Do not add to database when some value is nullYou have 2 options: 1) Define in the table creation that the column cannot receive nulls and, if you try to insert null, the bank puts a default value. Ex: CREATE TABLE tabela (coluna TEXT NOT NULL… 
- 
		0 votes1 answer101 viewsA: Attempt to invoke virtual method 'java.lang.String android.widget.Spinner.toString()' on a null Object ReferenceThe variables nomeS, contratadaS, tipoS and data should be null (so gives the error quoted when trying to call the toString() in them) because you are initiating them in this way: nomeS = (Spinner)… 
- 
		2 votes1 answer142 viewsA: Update BD after insert recordIn the database you don’t have to do anything. The way you implemented it, just reload your password list (List<Senha> senhas) and notify Adapter that the list has been updated with a… 
- 
		0 votes1 answer52 viewsA: I’m trying to create a Fragment that has an image slide any idea?You have to move the onCreate code to onCreateView and reference the layout views this way: Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)…