Posts by viana • 27,141 points
761 posts
-
7
votes1
answer699
viewsQ: What are function-oriented metrics?
Reading a little bit about Software Engineering, in one of the paragraphs, cites a little bit about function-oriented metrics or functionality, but nothing in-depth. There’s even a question in this…
-
7
votes2
answers412
viewsQ: What is the Demetrius Law about?
In a contest, I found the following question: In Object-Oriented Programming, the law of Demetrius (Law of Demeter) says that a method m of an O object should not invoke methods of following object…
-
1
votes3
answers1263
viewsA: How to make a field from a clickable table?
Using jQuery you can use the method window.location.replace($(this).data('href')). See an example of how it works: $(".rows").click( function(e){ alert($(this).data('href'));…
-
2
votes1
answer391
viewsA: Set Floatingactionbutton size on Android
Programmatically you can use the method setSize yes using the lib com.android.support:design:25.3.1. The definition should be this way below: FloatingActionButton fab = new…
-
2
votes2
answers828
viewsA: Format Timestamp for string without milliseconds?
Use SimpleDateFormat: SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); try { Date date = formatter.parse(notificacao.CreatedAt); String data = new…
-
1
votes1
answer385
viewsQ: How to toggle debug directory view for release, or vice versa?
In Android Studio on the left side corner it is possible to set the type of view relative to the directory structure, as in my case shows is set Android. See below: As you can see, the…
android-studioasked viana 27,141 -
1
votes1
answer199
viewsA: How to call youtube API with multiple parameters?
At first you can create a list of videos, then concatenate creating a StringBuilder. Behold List <String> list = new ArrayList <String> (); list.add("video_codigo_1");…
-
0
votes1
answer300
viewsA: Spinner does not display the selected value
Use the method getItemAtPosition passing as parameter the position clicked to catch the value. See: spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void…
-
0
votes2
answers259
viewsA: How to take Sqlite Database Date on Android and format in dd-mm-yyyy using viewHolder?
You can use SimpleDateFormat. Take an example: SimpleDateFormat formatter = new SimpleDateFormat("EEEE, MMM dd, yyyy HH:mm:ss a"); try { Date date = formatter.parse("Friday, Jun 7, 2013 12:10:56…
-
1
votes1
answer122
viewsA: How to add Shadow effect to a Framelayout?
You can add lift to his FrameLayout. Behold: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"…
-
0
votes1
answer510
viewsA: Sort by date and name Arrayadapter
Theoretically it was not for him to order by date and then soon after sort by name? Not simultaneously. This way in which you are doing, as you are using the method sort in the same Adapter, only an…
-
31
votes2
answers930
viewsQ: What is a meta language?
I found in the SO En that question: Creating meta language with Java, where the user is interested in creating a meta language using Java. I did a brief search and found on the Microsoft site a…
-
4
votes2
answers986
viewsQ: What is the purpose of setTag and getTag methods in View?
In the TextView declared this way below, is used the 1 as definition the attribute android:tag. Look at: <TextView android:id="@+id/tvJonSnow" android:layout_width="wrap_content"…
-
3
votes1
answer412
viewsA: Retrieve past information in a Bundle
To recover data from bundle, use the method getAguments(). See below for an example: @Override public View onCreateView(...) { . . Bundle bundle = getArguments(); if (bundle != null) { int id =…
-
2
votes1
answer699
viewsA: Why use Drivermanager for connection to bank?
Between the various interfaces of the package java.sql, referring to JDBC, there is the interface Connection defining methods for executing a query, commit transaction and close connection, among…
-
4
votes1
answer1142
viewsA: How to view images in Listview from Firebase?
You have more than one possibility to perform this procedure. I will show you 2 ways using framework and a "in race". Follow below: 1. Picasso The Picasso is a framework which allows the loading of…
-
4
votes1
answer1305
viewsQ: Can I get the list index inside for-each in java?
When we created the for traditional we do this way: for(int i = 0; i<strs.lenght; i++){ Log.wtf(TAG, "Jon Snow is "+strs[i]); } Now I have this foreach: for(String str: strs){ Log.wtf(TAG, "Jon…
-
4
votes2
answers64
viewsA: I don’t understand why the app closes
You have to instantiate the views within the onCreate. See how it should look: public Button ChangeNameButton; public TextView DogText; public TextView FishText; public TextView ExplainingText;…
-
5
votes4
answers5086
viewsQ: How to add values of a column in the table?
I have the following table below: <table class="table table-bordered table-hover" id="customFields"> <thead> <tr> </tr> <tr> <th width="20%">ID</th> <th…
-
0
votes2
answers77
viewsQ: How to pause and start audio when switching tab in browser?
On the Google Doodle of 117th anniversary of Oskar Fischinger I realized that when you change the tab, the music stops playing, and when you go back to the page again, it keeps playing. I created an…
-
1
votes1
answer45
viewsA: Application giving Crash on a button inside a custom Alertdialog
In place of getActivity() use the View. Take an example: Button btn_fin = (Button) mView.findViewById(R.id.concluirAdd);
-
5
votes2
answers6645
viewsA: What is the function of wrap_content?
The WRAP_CONTENT is a property that defines the size (height or width) of the view based on its content. This value indicates that the size of this element should fit the content assigned to it. See…
-
4
votes1
answer802
viewsQ: How to center map in the middle of polygon?
I have a polygon formed, at first, with 3 edges, basically created using 3 locations: Maiami, Puerto Rico and Bermuda. I took the example in the documentation that shows how to create a simple…
-
4
votes1
answer219
viewsQ: Replace space by comma and pipe interchangeably
I have a certain string below, as you can see, are coordinates separated only by a space. See: -23.5209 -46.46466 -23.52008 -46.465952 -23.519253 -46.467239 -23.518808 -46.466901 -23.518738…
-
4
votes2
answers1548
viewsQ: How does Asynctask actually work?
Still, sometimes I get a little confused by the AsyncTask. See an example below: private class MyAsyncTask extends AsyncTask<String, Void, String> { @Override protected String…
-
0
votes1
answer38
viewsA: How to place ad inside Alertdialog?
First you need to create a Personalized alertdialog. Soon after you insert the AdView referencing the dialog at the findViewByID. See below: AdView adView = (AdView)dialog.findViewById(R.id.adView);…
-
0
votes1
answer177
viewsQ: Check if field contains a date
I have a list of a EditText's which are filled with data returned from the database. Some have a common text, for example <EditText android:id="@+id/edittext" android:layout_width="fill_parent"…
-
1
votes1
answer34
viewsA: Problem opening a new Activity
There is no indication of errors in this section of your code. Most likely it may be the absence of your Activity in the AndroidManifest.xml. Check it and add the FormularioActivity if there is no.…
-
5
votes2
answers145
viewsQ: Long click with Javascript
In Android there is the method OnLongClickListener in which it is possible to hold down the finger in a View and an action is fired (if the developer sets an action) if that click remains a little…
-
4
votes2
answers1865
viewsA: How do I display a map with a proximation circumference?
Basically you need to create a Circle simple, as it shows in the documentation, and set a value for the property radius. For 2km, you need to put 2000 which is equivalent to 2 thousand meters. See:…
-
0
votes1
answer396
viewsA: Screen and Keyboard Settings
I usually use the attribute windowSoftInputMode passing by adjustPan as parameter. See: android:windowSoftInputMode="adjustPan" Add this to your AndroidManifest.xml, in Activity in which is the…
-
2
votes3
answers664
viewsQ: How do I upload all the files in the directory except for a specific one?
I would like to upload all files from the directory, except the config.php. I basically use the command git add . to add all the files, but when you have few edited files, I do so: git add…
-
0
votes1
answer131
viewsA: Return Spinner Value For String
To redeem the value of Spinner selected, use the method getSelectedItem. See below: String value = catliv.getSelectedItem().toString();
-
3
votes1
answer270
viewsA: Query the Database in Android
For the mistake you’re making and for what I just read, it seems that the same is occurring because Sqlite does not support the function ACOS, other than those contained in query. See the most…
-
2
votes1
answer92
viewsA: Is it possible to change the function of the physical button, even with the app in the background?
It seems to me not possible, however for some certain cases like Google Play Music (service stream music), he uses the KEYCODE_VOLUME_DOWN and KEYCODE_VOLUME_UP to decrease and increase the volume…
-
1
votes1
answer81
viewsA: How to create a Chronometer in a notification?
As asked by @wakim, I did a brief search on the class RemoteViews where the method can be used setChronometer() to create a custom notification. See below for how to look: JAVA RemoteViews…
-
3
votes2
answers76
viewsA: How do I search for a string in a table on Android?
If you go through the column nome, can do this way using the operator =: cursor = db.query(DadosDB.NOME_TABELA, fields, "nome =?", new String[] {"nome"}, null, null, null, null); But this case is if…
-
2
votes2
answers261
viewsA: Problem with animation in Android Studio
Instead of: animation.start(); you must use: botaoAjuda.startAnimation(animation); Note that you did not assign any animation to the button, simply created a variable of type Animation within it.…
-
0
votes1
answer81
viewsQ: How to create a Chronometer in a notification?
I have the following method below: public NotificationCompat.Builder createNotification(Context context) { Intent intent = new Intent(this, MapsActivity.class); PendingIntent pIntent =…
-
3
votes1
answer1722
viewsQ: What is the real difference between the operator '=' and LIKE?
Doing another test (rs) in a database I have in Mysql, I realized that: SELECT * From client WHERE uuid = '1kvsg4oracxq' returned the same result as: SELECT * From client WHERE uuid LIKE…
-
0
votes1
answer716
viewsA: Open Activity if you don’t have internet
First you need to check if there is connection using the method isOnline() (is only an alternative), this before you set your WebView. For example: private WebView wv; @Override protected void…
-
0
votes1
answer82
viewsA: I can’t use Loginbutton from Facebook SDK
The mistake you are making in your application is exactly when inflating the LoginButton: android.view.Inflateexception: Binary XML file line #26: Error inflating class…
-
1
votes1
answer327
viewsA: Add items to the top of Recyclerview with Firebaserecycleradapter
You can use the static method reverse() class Collections. Since your code does not contain where you rescue the list items, I will give a basic example below: ArrayList<String> actores = new…
-
2
votes1
answer1001
viewsA: How to open a Alertdialog?
Create a variable of type DialogoStartGPS, which you have created, in which the class extends DialogFragment. Then use the method show to be launched on the screen by passing as parameter…
-
12
votes2
answers736
views -
19
votes3
answers9682
viewsQ: What’s the difference between Where and having?
Doing some tests on a database that in Mysql, I realized that: SELECT * From client WHERE uuid = '1kvsg4oracxq' returns the same result as: SELECT * From client HAVING uuid = '1kvsg4oracxq' What…
-
1
votes1
answer107
viewsA: Listview Loses Focus Back
One option would be you save the index and the position of the first item on the list before going to the layout details, this is if you are not finishing the item screen. The reason you are losing…
-
1
votes4
answers645
viewsA: How do I insert a button after a listview?
How are you wearing ListView, you can use the method addFooterView, in which you will add a View at the bottom of your list, as if it were the last item. See: Button btnFooter = new Button(this);…
-
0
votes1
answer93
viewsA: Application Stopped Webview
The error is because you declared a variable of type WebView global, as I indicated in the reply on Back to Webview, but this is not instantiating it. Just below you should remove the final WebView…
-
2
votes1
answer576
viewsA: Back to Webview
First check if it is possible to return to the previous screen using the method canGoBack of your WebView. If yes, use the method goBack to return, otherwise use finish to end the current activity.…