Posts by ramaral • 44,197 points
1,060 posts
-
5
votes1
answer43
viewsA: How can I have that blue mask on my application?
After obtaining a map reference use the method setMyLocationEnabled. mGoogleMap.setMyLocationEnabled(true); You should declare the following permissions on Androidmanifest.xml: <uses-permission…
-
1
votes3
answers210
views -
1
votes1
answer221
viewsA: Error creating Class on Eclipse Android
I recommend you download the most current version of Android SDK which at this time is 6.0. On Androidmanifest.xml put the following: android:minSdkVersion="7" targetSdkVersion="23" If you don’t…
-
2
votes1
answer419
viewsA: Change data from a specific position in Listview
To Listview is a visual representation of the data from a data source. The data is converted into Views using a Adapter Thus, to change any given/value shown by Listview, it is necessary to amend…
-
0
votes2
answers205
viewsA: Create table in Sqlite with array
Sqlite does not have the type Arraylist because it makes no sense. The Arraylist is a type that represents a list and a list is represented, in Sqlite(and not only), by a table. Thus, you should…
-
4
votes3
answers8198
views -
1
votes1
answer214
viewsA: Adding a Edittext dynamically and modifying the layout_width, layout_height and
Should create a Linearlayout.Layoutparams, define the weight value in the attribute Weight and then assign it to Edittext: //Cria um objecto LinearLayout.LayoutParams LinearLayout.LayoutParams…
-
2
votes2
answers94
viewsA: Parameters of Android configuration
It is possible to obtain this information using the Settings.System Some of the constants are therefore obsolete due to the target api that you intend to use, consider using, for the same purpose,…
-
1
votes2
answers99
viewsA: Spinner behavior with database data in Lifecycle
You must do the override of the method onSaveInstanceState and save the indexes of the selected items of each spinner. Later, when the Fragment is recreated, you can obtain these values through the…
-
1
votes2
answers286
viewsA: Difficulty transcribing a console application program for windows form(C#)
A Label you can only use one text at a time. Whenever you are assigned a value, through label1.Text = palavra;, the previous text is replaced by the new. Despite using the Thread.Sleep(1000); the…
-
3
votes1
answer175
viewsA: Using variables from other sources (C#)
One possible way is to declare a constructor in the second window class that receives a string: public partial class Form2 : Form { private string texto; public Form2(string texto) {…
-
2
votes1
answer857
viewsA: How to get the features of Android device
This information can be obtained by using the Build It contains several static fields containing information about the device. Examples: String produto = Build.PRODUCT; String modelo = Build.MODEL;…
-
2
votes3
answers97
viewsA: How to make "Adapter.getItemPosition" take only part of the String and hide the other part when presenting Listview?
I suppose your Adapter be the type ArrayAdapter<String> and hence its difficulty. My suggestion is that you declare a class called Parents and declare the Adapter as ArrayList<Pais>.…
-
3
votes3
answers797
viewsA: How to consider an empty Edittext as "0"
This can easily be achieved by declaring your Edittext with its default value equal to zero and indicate that it can only receive numerical values: <EditText android:id="@+id/edittext"…
-
1
votes1
answer162
viewsA: Checkbox with Radiobutton appearance
Add the following attribute to Checkbox: style="@android:style/Widget.CompoundButton.RadioButton" Example: <CheckBox style="@android:style/Widget.CompoundButton.RadioButton"…
-
2
votes4
answers1275
viewsA: How to identify changing the state of connectivity to the Internet to perform a method when connecting?
To be notified when a network connectivity status change(network) shall declare a Broadcastreceveir to respond to Action android.net.conn.CONNECTIVITY_CHANGE On Androidmanifest.xml log the…
-
1
votes2
answers249
viewsA: How to specify that the constructor type is equal to the one declared in the class?
From the research I did it is not possible to resolve this issue at compile time. However the compiler(Eclipse) gives the following Warning: Type Safety: The Expression of type Grid needs unchecked…
-
4
votes3
answers1050
viewsA: Increasing the size of a Textview, according to the amount of data entered in it
The attributes that determine the size of a View sane android:layout_width and android:layout_height Its value can be a fixed dimension, expressed by a decimal value, or a constant that defines how…
-
2
votes3
answers189
viewsA: Handling items from an Action Bar outside the onCreateOptionsMenu()
It is not possible to manipulate something before it has been created. So you’ll only have access to Menu after the method onCreateOptionsMenu() have been executed. I suggest you do the following:…
-
1
votes1
answer6803
viewsA: Capture value from an Edittext
Gives error in line String unidademetalica = txtum.getText().toString(); because you didn’t get the reference to Edittext R.id.txtum In order to access txtum you will have to put, in the method…
-
5
votes4
answers2280
viewsA: String Manipulation - split()
Yeah, do it like this: String nome = "Dan Lucio Prada"; String sobronome = nome.split(" ")[2]; Of course, this only works if the name has three words.
-
3
votes1
answer62
viewsA: How to detect if a file is in use?
You can use this method to make this check: protected virtual bool IsFileInUse(FileInfo file) { FileStream stream = null; try { stream = file.Open(FileMode.Open, FileAccess.ReadWrite,…
-
1
votes1
answer53
viewsA: Link model information to a Listview correctly
If what you want is to get the object MeuObjeto which is associated with the clicked item of Listview, the Arrayadapter provides the method getItem(position) for that reason. It can be used in…
-
3
votes2
answers447
viewsA: How to adapt / create a method that receives an anonymous class in C#
In C# you can resort to a delegate to pass a function/method to another method. C# provides some delegates ready-to-use. If you only need to use static methods of the class Objectmapper I suggest…
-
4
votes2
answers225
viewsA: Migrate data from one version to another - Android Sqlite
I don’t know what kind of upgrade you want to do to the database but this upgrade can be done with or without the need to delete and then recreate all tables. For this, in the method onUpdate(), use…
-
0
votes1
answer138
viewsA: Broadcastreceiver ACTION_SETTINGS. Does not intercept
I believe you are facing the same problem/confusion expressed in this question, whose reply is simple: You cannot "Intercept" startActivity() calls using a Broadcastreceiver. To Broadcastreceiver…
-
1
votes1
answer2790
viewsA: App runs on emulator but no icon appears
So that your application has its icon in the application area you must have, on Androidmanifest.xml, an Activity declared with a intent-filter which, in addition to a action…
-
7
votes2
answers427
viewsA: What is the sequence of executions for Asynctask?
Can you guarantee that the Asynctask’s are executed in sequence using the executeOnExecutor() to execute each of them. This method takes as a parameter the Executioner which will execute Task’s, if…
-
1
votes1
answer161
viewsA: How to receive automatically, in Activity, a value calculated in a Service?
One of the possible ways for the Service communicate with the Activity is to use Localbroadcastmanager to generate a broadcast to be received by Activity Service Start by declaring constants to be…
-
0
votes3
answers1265
viewsA: How to fill an array of another class in JAVA
Seeing the signature of your method: public void preencherArrayCidades(ArrayList acidades) he gets a Arraylist to be completed with the result query however what you are doing is creating a new…
-
3
votes1
answer118
viewsA: Insert marginRight in a Textview from Java code
You must create an object of the type Linearlayout.Layoutparams, indicate the parameters and assign it to the Textview: public void inserirLacunas(){ LinearLayout ll = (LinearLayout)…
-
1
votes2
answers1368
viewsA: How to get the coordinates (X and Y) of a click on an imageview?
event.getX() and event.getY() return the coordinates relative to the upper left corner of the Imageview. Like the dimensions of Imageview may be different from the image it contains, a conversion is…
-
15
votes3
answers2778
viewsA: What is the purpose of "continue" in C?
continue is one of the commands that can be used to modify the normal loop execution path. The command continue passes control to the next iteration of loop, ignoring the remaining instructions. The…
-
1
votes1
answer101
viewsA: List changes color at wrong position
The picture perfectly explains why this is happening. Suppose item 1 is the one where you change the color, as it is reused, when generating item 8, it also appears with the color changed. You have…
-
7
votes2
answers1683
viewsA: Convert a collection from Set to List type
The class Arraylist has a builder that accepts a Collection, use it to build the List: List<String> list = new ArrayList<String>(oSeuSet);…
-
2
votes3
answers465
viewsA: Media Player setDataSource
The method setDataSource() has several overloads, the one you are trying to use gets a path. The method toString() class Uri does not return a path but rather the representation, in string, of Uri…
-
0
votes1
answer287
viewsA: How to pass data to Activity itself after the camera is called?
The simplest way to persist a value during Activity destruction/recreation is to do the override of the method onSaveInstanceState() and keep this value in Bundle passed to him. private String…
-
2
votes1
answer90
viewsA: Error returning list to Activity
The process of obtaining connected/paired devices takes some time to complete. At the time the Toast is executed, in the method onClick(), right after the call to leitor.buscarBluetooth();, there…
-
0
votes2
answers1697
viewsA: Datatimepicker display time only
According to the documentation in addition to changing the format to Team it is necessary also to "set" with true the property Showupdown timePicker = new DateTimePicker(); timePicker.Format =…
-
1
votes1
answer132
viewsA: How to use View Animation
Android provides various types of animations that can apply to a Imageview. The one that applies in your case is Rotateanimation. Its use is done in 3 steps: 1 - Create an object of type…
-
3
votes1
answer1487
viewsA: How to set a text based on the Edittext id and not the Edittext name?
If the Edittext are associated with a View/Layout can obtain the reference to each of them through the Id using: EditText edit = (EditText)view.findViewById(id); view is the Linearlayout where the…
-
2
votes2
answers136
viewsA: Android file monitor
To monitor changes in an Android folder use class Fileobserver A possible implementation would thus be: public class FileMonitor extends FileObserver { public MyFileObserver(String path) {…
-
3
votes1
answer552
viewsA: How to use a custom Adapter on android Listfragment
If the function of your Listfragment is merely presenting a Listview doesn’t need to create it since he has one by default. Moreover, this is not a Context for that use getActivity() Change the…
-
6
votes1
answer113
viewsA: Maintain background in Drawingview
Instead of drawing the paths directly into Canvas of View use one another Canvas associated with a Bitmap and draw on it. In the onDraw() draw this Bitmap on the canvas of View. Declare two new…
-
2
votes2
answers386
viewsA: Listview catching plenty on scroll
The problem is that the method get() of Asynctask only returns when the method doInBackground() end. You are using the Asynctask synchronously. Change the class Downloadtask in order to receive the…
-
5
votes2
answers2051
viewsA: Merge two distinct lists using LINQ
It’s in the part select new { c, e }; which determines the returned object. For example if you want to return an object with Name and Street do: select new { c.Nome, e.Rua };…
-
3
votes2
answers2833
viewsA: Enabling Internet Connection in an Android App
To know the status of a network connection it is necessary to obtain an object of type Networkinfo. The way to achieve this is by resorting to the class Connectivitymanager obtained as follows:…
-
2
votes1
answer374
viewsA: How to assign an Activity to open by clicking on the Actionbar Tab?
This part of the code is not correct: actionBar.addTab( actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener( new TabListener<MapFragment>(R.layout.activity_map),…
-
0
votes1
answer415
viewsA: Inserting Textview into a Listview
First you have to create a Layout which will represent each of the Listview. In your case it will be a Linearlayout with a Textview within. res/layout/item_list.xml <?xml version="1.0"…
-
7
votes1
answer578
viewsA: Zoom with fingers on app
One way to do this would be to detect the movement and then execute the code that transforms the View where the movement was made. To detect the movement we use the class Scalegesturedetector…