Posts by ramaral • 44,197 points
1,060 posts
-
3
votes2
answers749
viewsA: Rendering error - class could not be found: android.support.v7.internal.app.Windowdecoractionbar
The problem is you are using the version 23.1.1 of appcompat-v7 together with Actionbar. There are three solutions: Revert to the version 23.0.1 Understudy Actionbar for Toolbar and make their theme…
-
1
votes1
answer153
viewsA: Error inflating class Fragment using maps
If the layout contains only the map does not need to include it in a Linearlayout. The activity_maps.xml it will be worth it: <fragment xmlns:android="http://schemas.android.com/apk/res/android"…
-
1
votes2
answers79
viewsA: Toast is not displayed with GPS position
The Toast is within the method onLocationChanged(), as its name indicates is only called when there is a change of its location.(1) As long as there is no such change, within the limits set out in…
-
5
votes4
answers1876
viewsA: What is the sense of an attribute being private and Static at the same time in a class?
The reasons for private static sane: private by not wanting it to be visible outside the class. static because a field cannot be referenced static in a method static as is the case getInstance()…
-
1
votes3
answers1653
viewsA: Arraylist for String with split
If what you want is to get employees ordered by different fields do not need to make these breakups. From a List<Funcionario> you can order it however you want. List<Funcionario>…
-
4
votes1
answer174
viewsA: How to know what "MATCH_PARENT" will look like when the view is drawn?
The dimensions that are assigned to the view, when declared with match_parent or wrap_content, are calculated only at the time they are presented(Measurement phase), this is only done after the…
-
3
votes3
answers1110
viewsA: I have 5 threads running in parallel. How do I know when they’re all gone?
The @Victor response, although correct, blocks the thread which, in the case of Android, is not advisable. The solution is to create a thread to run the joins: public class Main { private static…
-
7
votes2
answers525
viewsA: When is it recommended that a class implement Idisposable?
The function of the block using{}, using your words, it’s not "killing" an object so that it "doesn’t get loose". This is the responsibility of Garbage Collector. The method Dispose(), that is part…
-
1
votes1
answer98
viewsA: Error: The method getFragmentManager() is Undefined for the type Activitieslistadapter
You’re trying to access the method getFragmentManager() that does not exist in the class Activitieslistadapter. getFragmentManager() is a method that exists in the classes Activity and Fragment. The…
-
3
votes2
answers97
viewsA: Log all of an Activity’s touch events?
I found the challenge interesting so I made two small classes, Toucheventlogger to log "Touch Events" and Gestureeventlogger for the "Gesture Events". Both inherit from Motioneventlogger.…
-
0
votes1
answer210
viewsA: Retrieving texts typed in Edittext generated at runtime
Assign a different id to each of them using e.setId(int id) You can then access them using the method findViewById() view(layout) where they were inserted.
-
2
votes1
answer185
viewsA: Recylerview Horizontal as Whatsapp
When you create a Recyclerview you have to assign a Layoutmanager. In this case (horizontal list) assign a Linearlayoutmanager specifying LinearLayoutManager.HORIZONTAL in the builder:…
-
11
votes4
answers25519
viewsA: The input character string was not in an incorrect format. Operators
The RAM() method returns a string that is not convertible to an integer. Notice this line of this method: return MemSize.ToString() + "MB"; change to: return MemSize.ToString(); should work.…
-
2
votes2
answers3886
viewsA: How to change edittext line color programmatically
From the version V22.1 of appcompat-v7 it is possible to define a style and attribute it to Edittext through the attribute android:theme. In the archive res/style.xml declare a new style: <style…
-
1
votes1
answer187
viewsA: How do I let "bind" to "Sqlitestatement" accept a null value in Sqlite?
It has two forms but both require a prior test to verify that the value is null: Using bindNull() String sql = "INSERT INTO table (number, nick) VALUES (?, ?)"; SQLiteStatement stmt =…
-
3
votes4
answers311
viewsA: Creating Data Base through Stringbuilder
In the documentation may verify that the execSQL() only executes one SQL statement at a time. You will have to build each of the "Create Table...", one at a time and run them in turn.…
-
0
votes1
answer60
viewsA: Text update in Notification
The way to update a notification is to always use the same id when calling NotificationManager.notify(). If the "blink" refers to the small icon that appears when the notification is launched, use…
-
4
votes1
answer2358
viewsA: Placing event click on the button that is in a Fragment, in an Activity?
You can’t/should do it like this. It’s the Fragment that should receive the events of its views. The method findViewById() can only find the views that are part of the layout passed to the method…
-
1
votes2
answers3258
viewsA: Add dependency on android studio
This format you indicated is the format used by Maven to declare a dependency. The Android Studio uses Gradle to manage dependencies and build applications. There are two ways to declare a…
-
3
votes1
answer647
viewsA: How to play a sound using Mediaplayer?
Do so: //Declare uma variável de instância para o player private MediaPlayer mp = null; //Escreva um método para tocar o som public void playMusic(int songId) { //Se algum som ainda estiver a tocar…
-
1
votes1
answer65
viewsA: How to rebuild the XML of a Fragment layout when it is expanded?
In the layout of Activity add a Framelayout wherever the content of Fragment: ..... ..... <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content"…
-
0
votes1
answer68
viewsA: Cursor count returns more values but only adds one item in the list
The condition used in the while(cursor.isLast()) returns false on the first run, because the cursor is not in the last position. For the test result to work it must be denied:…
-
2
votes1
answer341
viewsA: Error inserting Mysql PHP data using Android Volley lib
Analyzing the code posted and based on the tutorial cited, I think the error occurs in the line ConMain2.getInstance().addToReqQueue(postRequest); The first reason is that class Conmain2 does not…
-
2
votes3
answers552
viewsA: How to convert pixel to dp?
In order for the dimensions to remain consistent between the various types of screen you should think in terms of dp and not pixel. As most (I would say all but I’m not sure) of the methods that use…
-
2
votes1
answer467
viewsA: Media Player, stop sound before playing another
Before creating a Mediaplayer destroy the previous one, if any. //Use sempre a mesma variável para guardar o objecto MediaPlayer private MediaPlayer mp = null; public void nelson (View view) {…
-
2
votes2
answers1348
viewsA: How to show the largest number typed, using functions?
I believe that the simplest way is to keep the largest number entered and, after each entry, check whether the number entered is greater than this, if yes becomes the largest entry. int main(void) {…
-
1
votes1
answer38
viewsA: Value conversion Date no sqlite Android error The method gettext() is Undefined for the type String
The error says that the String class has no method with the name gettext The method parse() class Simpledateformat receives a String, as you say in the question, the attribute consumo.dt_leitura is…
-
1
votes2
answers243
viewsA: Google Play Services generating errors
The problem is because you’re declaring compileSdkVersion=19. The archive values-21.xml uses Resources which only exist as of version 21. The application will therefore have to be compiled at least…
-
3
votes3
answers182
viewsA: How to instantiate an Activity with Edittext fields without being automatically selected?
A simple form is in the Androidmanifest.xml declare Activity in this way: <activity android:name=".MainActivity" ..... android:windowSoftInputMode="stateHidden" >…
-
1
votes1
answer289
viewsA: One Fragment’s onCreateContextMenu method calls another Fragment’s onContextItemSelected method
There are two ways to deal with this situation: 1 - Assign a groupid different for each item group of each menu. Fragment Compra: menu.add(1, 0, 0, "Informações adicionais"); menu.add(1, 1, 1,…
-
4
votes2
answers600
viewsA: Error using apache Httpclient class
In Android version 6.0 (API level 23) customer support has been removed HTTP Apache. Instead of her use the class Httpurlconnection. This API is more efficient as it reduces network usage and…
-
2
votes2
answers307
viewsA: Listview duplicating data in android app
The problem has to do with the call Activity Lifecycle. During his lifetime a Activity passes through different states, in each of them is called the respective life cycle method(Lifecycle callback…
-
7
votes2
answers681
viewsA: How to display a Toast inside a Thread on Android?
The reason is that objects using the UI are not allowed to be accessed, as is the case with Toast, in a Thread other than the Uithread(Mainthread). In the method run() of Thread use the method…
-
2
votes1
answer137
viewsA: Parameters via xml for custom Imageview
It is possible to create custom attributes. For this it is necessary to declare a Attribute Resource: In the folder res/value create a file called attrs.xml with the following content:…
-
0
votes1
answer54
viewsA: Add items to an Expandable List
The mistake happens when you do the add() on the list categoria_header. If the first category has no products nothing is placed on the list, the i is increased, passes to 1, when trying to add i = 1…
-
0
votes1
answer102
viewsA: Error when referencing global variable
If you want to access the attributes conect and url class Conectactivity shall do so directly using their names. The word selfdoes not exist in JAVA. So that these attributes can be used in a inner…
-
4
votes2
answers184
viewsA: Have images in the tables where they will be used or table with image repository?
The second form, definitely(1). An image is an image, regardless of what it represents. What is not "normal" is to mix category information(fields) with image information(fields). This has to do…
-
2
votes1
answer1588
viewsA: How to open the Google Maps app via Intent at a given Latitude/Longitude?
Latitude and longitude available in class User such data may be obtained in the same way as "Name", "Crm", "Telephone", etc. Then just create the Intent to launch the Google maps. ....... .......…
-
0
votes1
answer115
viewsA: How to turn text into an image
To put an image as background of a Textview use the following code: textView.setBackground(getResources().getDrawable(R.drawable.image)); If you are using API level 21 or higher use:…
-
4
votes2
answers5551
viewsA: How to play sound on android
In your button method use the following code: MediaPlayer mp = MediaPlayer.create(MainActivity.this, R.raw.sound); mp.setOnCompletionListener(new OnCompletionListener() { @Override public void…
-
2
votes1
answer410
viewsA: Webview always asking where I want to open the url
Before calling the method loadUrl() indicate to webView which client to use: String url = "http://google.com"; WebView wv=(WebView) findViewById(R.id.webView); WebSettings ws = wv.getSettings();…
-
0
votes1
answer849
viewsA: Capture txt file row by row and play in a txtbox
The problem is that you are assigning the content of each line to Textview within the cycle while. Each time a new assignment is made restore what the previous one had assigned. One solution is to…
-
2
votes2
answers444
viewsA: What is the correct way to call a method from a class that inherits from an Activity?
No class I inherit from Activity should/can be instantiated with "new". One Activity is an application component that provides a screen with which users can interact in order to do something.[Read…
-
3
votes1
answer49
viewsA: I can’t see Listview
In the method CarregaTela2() should create a Intent to launch Activity Specialties. What you’re doing is just changing the layout which Mainactivity presents. Change the method like this: public…
-
3
votes2
answers1223
viewsA: How to get all data from one table based on another table?
After editing the question the following lines became meaningless. Who should have a FK should be the table of countries and not the table of continents. A country belongs to a continent and not the…
-
2
votes1
answer654
viewsA: Scrollview only in the desired textView
You have to put the positioning attributes in Scrollview and not in Textview: ......... ......... <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content"…
-
2
votes1
answer602
viewsA: Resize bitmap without blurring
Android SDK provides the class Roundedbitmapdrawablefactory which make it possible to obtain drawables with the rounded corners. Your methods return a Roundedbitmapdrawable using the method…
-
0
votes1
answer128
viewsA: Comparing textView to txt using Android arrayList
Your logic is wrong in many ways: Does not leave the loop inside when you find a match. As the warning lies within the loop interior, if the application to search is not the first, even if it is…
-
2
votes2
answers2892
viewsA: Android - Alarm for mobile according to system time
To make a repeat alarm you must use one of the following Alarmmanager methods: setInexactRepeating() or setRepeating(). In both are the second and third parameter that inform when and with what…
-
1
votes1
answer1009
viewsA: Pick a specific part of a string using ANDROID split method
The function is not required split. If it is the last part of the text it is simpler to use the methods substring and lastIndexOf class String String parteFinal = texto.substring(texto.lastIndexOf("…