Posts by ramaral • 44,197 points
1,060 posts
-
1
votes1
answer208
viewsA: Check that Notification is active
That I am aware this is only possible from the API18 through the implementation of a Notificationlistenerservice or from the API23 using the method getActiveNotifications() of the Notifitionmanager.…
-
2
votes1
answer124
viewsA: List Adapter duplicating positions in Listview
You are to assign the OnClickListener() only when the convertView is void. When the view is repurposed to another position, which was passed to the Istener, retains its initial value, the one it had…
-
4
votes1
answer205
viewsA: How do I know if there was a glitch in texting?
Shipping failures do not launch exception, they are reported otherwise. If you look at the signature of the method sendMultipartTextMessage you’ll see he gets two Arrays<PendingIntent>,…
-
10
votes3
answers175
viewsA: Why is my Array item not changed in foreach?
Cannot restore the contents of an array or collection position via foreach. You have to use the for classic for this. The Array, in a simplistic way, it is stored in memory as follows: Each of the…
-
2
votes1
answer349
views -
3
votes1
answer68
viewsA: Swap operator + for - in refactored method
Apply your algebra knowledge: x + y = x + (1)*y x - y = x + (-1)*y Create a new method and put this repeated code on it, use the one that has the signal + and multiply the section…
-
2
votes1
answer457
viewsA: How to make a menu item visible on Toolbar by clicking an existing one?
Yes, this should be done in the method onOptionsItemSelected() but first you must obtain and keep a reference to Menuitem salvage in the method onCreateOptionsMenu(): //Variável para guardar o…
-
1
votes1
answer601
viewsA: display listview in the same Activity after consultation
No, the problem won’t be having the Listview in the same Activity. There are "problems" in the code but, in the beginning, are no reason not to work as you want. I say "from the start" because I…
-
2
votes2
answers1753
viewsA: How to pass images between Activities?
What you have to do is pass the Bitmap who is in the Imageview of list item. The same way you do for Textview get the reference to the Imageview: ImgeView slide1 = (ImageView)…
-
6
votes1
answer987
viewsA: Convert a String Arraylist to a Json
You’ll have to build a Jsonobject for each item of mPackages and add it to the Jsonarray: //Cria e inicializa ArrayList que contem os packages instalados no Aparelho ArrayList<String>…
-
2
votes1
answer777
viewsA: Error changing table SQLITE - in such column
When changing the structure of the BD it is necessary to inform the Sqliteopenhelper(Bank) class of that change. The mechanism it uses is to check the value of the parameter version passed in the…
-
1
votes2
answers1011
viewsA: update method (sqlite) does not update database data
Not updating database data because values passed to method db.update() are bad: remove space on "livro " and " "+livro.getId(): db.update("livro", values, "_id = ? ", new…
-
3
votes3
answers8112
viewsA: Is there any way to pass methods as a parameter?
It won’t be quite what you want but I think it will be as close as you can get (without using Reflection). Define an interface: public interface Action<T> { void execute(T valor); } For each…
-
1
votes1
answer98
viewsA: The last Listview item is always deleted even by deleting an item in the middle of Arraylist
Eliminate the line if (v == null){ and its }. As it stands this block is only executed when the convertView is null, when it is not, then a view used by another item will be repurposed, causing the…
-
2
votes1
answer40
views -
3
votes1
answer61
viewsA: Importing images from Google to the Android app
The second parameter of the method startActivityForResult() is an integer to identify this "request". startActivityForResult() is used in conjunction with the method onActivityResult() which will be…
-
13
votes3
answers600
viewsA: What does this() do alone in the builder?
this is a reference to the current object - the object whose method or constructor is being called. When used inside a constructor serves to call another constructor in the same class. Your Class…
-
4
votes1
answer685
viewsA: How to apply the two add-on to an Hex string in c#?
A simple way may be to calculate the complement to 1 and add 1 as described in the entry Complement to two wikipedia. I say it’s a simple way because it’s easy to calculate the complement of 1, just…
-
2
votes2
answers194
viewsA: How to open an image inside an Imageview in its original size?
The attributes defined in Imageview is that will determine the size of the image. How it is displayed, resized (Scaled) or cut will depend on the attribute android:scaleType. However, when you want…
-
1
votes3
answers1282
viewsA: Take screen size in xml
I’m not going to give you a ready-made solution because it would be a bit extensive, and I can’t find a solution for the case where the application is initially executed in landscape mode. To obtain…
-
14
votes2
answers289
viewsQ: New C# 6 functionality "Auto-Property initializers" is just a facilitator?
One of the new C#6 features is the possibility to initialize properties at the time of declaration. public class Customer { public string First { get; set; } = "Jane"; public string Last { get; set;…
-
2
votes1
answer3080
viewsA: With filling a spinner with an object field
The ideal way is to write an Adapter for this purpose. Not wanting to have this "job" and using the Arrayadapter, an expeditious way is to take advantage of how the Arrayadapter works. The…
-
4
votes4
answers334
viewsA: Advantages of Inner Class
With regard to the Android and specifically the use of Inner Class in a Activity his concern should be focused on the problems that he(use) can bring with regard to Memory Leaks. The life cycle of a…
-
6
votes2
answers1705
viewsA: Why does unreachable code Detected error occur in C#?
This warning/error indicates that there is code that will never be executed regardless of the execution path. Note that when the execution reaches the block try/catch, whether an exception is made…
-
6
votes1
answer188
views -
2
votes1
answer33
viewsA: How to rescue Edittext values created via script?
To be able to access the content typed in each Edittext use: String textoDigitado = pairs[indice].getText().toString(); where indice is the position of Edittext in the array whose content it seeks…
-
2
votes1
answer3041
viewsA: Check if an application is installed on the device
To get a list of information regarding all installed applications use the method getInstalledApplications() packagemanager: PackageManager packageManager = getPackageManager();…
-
1
votes1
answer1143
viewsA: View BD Sqlite on Android Device Monitor
Only the contents of the folder can be accessed Data if the device be an emulator*. The comic book is located in: data > date > your-package-name > Databases > your-database-file. The…
-
1
votes1
answer160
viewsA: Slow Motion in Transition from Android Pager View
I think that this should be in line with what you want: private final static int PAGER_TRANSITION_DURATION_MS = 500; private void animatePagerTransition(final boolean forward) { ValueAnimator…
-
1
votes2
answers300
viewsA: Android: Saving Data in Files
To add data to an open file with openFileOutput(String name, int mode) the value for the parameter mode must be Context.MODE_APPEND Change the line FileOutputStream fileOutputStream =…
-
4
votes1
answer54
viewsA: Error when trying to set custom Actionbar: java.lang.Nullpointerexception
You are wearing android.support.v7.app therefore its Activity must inherit from AppCompatActivity. Replace the line public class MainActivity extends Activity { for public class MainActivity extends…
-
4
votes2
answers321
viewsA: Problem with hasNext() Java
The class Scanner does not provide any method to return to the beginning. The only way to do that is to re-create a new object Scanner, do this after the line int numLinhas =…
-
4
votes1
answer278
viewsA: Themes, Styles and support android Library
These attributes are only available from API level 21. In order to be used in previous versions we will have to resort to those that are defined in appCompat api. So that these Styles/themes is…
-
3
votes1
answer292
viewsA: Stop touch(sound) of notification
Configure the notification so that it is it that performs the touch and vibration. NotificationCompat.Builder builder = new NotificationCompat.Builder(context); .... .... //Definir o toque Uri som =…
-
1
votes1
answer576
viewsA: Error: java.lang.Illegalargumentexception: column '_id' does not exist
In order to use a Simplecursoradapter it is necessary that your table has a column called _id and that it is present in the outcome of query that the cursor represents. The column shall be declared…
-
0
votes2
answers221
viewsA: Memory problems when loading many images in listview
I am not going to give you a complete solution because that would imply writing a tutorial. To solve the problem of Outofmemoryerror replace the line Bitmap myBitmap =…
-
2
votes1
answer97
viewsA: Is the Mediaplayer.create() method called in the background?
The method MediaPlayer.create() is not asynchronous. It could not be because it returns an instance of Mediaplayer. He internally calls the method prepare() thus returning the Mediaplayer…
-
6
votes1
answer782
viewsA: Notification at 0h00 without starting application
The solution is to set the alarm that will launch the service that generates the notification at the start of the device. This service must be performed every day at 0.00. To this end, please note…
-
1
votes1
answer435
viewsA: How to place border on a selected item in Listview?
Follow these steps: 1 - Add the attribute android:choiceMode à Listview, to allow selecting only one line: android:choiceMode="singleChoice" to select more than one line:…
-
2
votes3
answers531
viewsA: Using Activity Methods in a Fragment
If what you want is to use Asynctask in any class declare it in a separate file and define a constructor that receives a context and a Listener where the result will be passed. public class MyParser…
-
2
votes4
answers756
viewsA: Remove a specific space in a string
One possible way is to use a Stringbuffer and use the method replace(): String hora = "8 hrs 2 mins"; int firstSpace = hora.indexOf(" "); int lastSpace = hora.lastIndexOf(" "); StringBuffer buf =…
-
1
votes3
answers359
viewsA: How to assign a zero value to a variable(s) before running the program?
You can always initialize Edittext with the value 0 in the activity_calculo_cr.xml using the attribute android:text="0" <EditText android:id="@+id/edittext" android:layout_width="fill_parent"…
-
2
votes1
answer308
viewsA: Treat exception in an Asynctask
You’re treating the error in doInBackground() so that when one happens, the method returns null. The value returned by doInBackgound() is passed to the method onPostExecute(). So the problem is you…
-
0
votes1
answer200
viewsA: Synchronous Creation of Android Surfaceview
If the "valid state" of a class instance Myview depends on a call to a callback it is as if the "creation of the instance was asynchronous" I do not see how it is possible to ensure that the…
-
1
votes1
answer90
viewsA: Does Webservice (Asynctask) only work with Debug?
Although I have not posted the error I am 99.99% sure it is NullPointerException. The reason is that the list listaLida is only initialized within the doInBackground() of Asynctask. But even if you…
-
0
votes1
answer424
viewsA: I want to put more than one paragraph in my android xml, do you have how?
Has two possibilities: Add another Textview at the layout and divide the text between the two. Put a value in dp(ex.: 100dp) or match_parent in android:layout_width. In the case of the dp the…
-
0
votes1
answer808
viewsA: Mark/Deselect Radiobutton Component in Expandedlistview
To check the automatic unchecking when a choice of another option occurs, it is necessary that the Radiobutton are grouped within a Radiogroup. In your case I don’t see how it’s possible to include…
-
1
votes1
answer327
viewsA: Notification Bar with Bigpicturestyle and 2 lines text?
In order to appear the 3 lines of text plus the text "info" has to do so : Notification notif = new NotificationCompat.Builder(this) .setContentTitle("Title") .setContentText("Text")…
-
3
votes3
answers1444
viewsA: List of questions, each question with a list of answers
In fact use a scrollable view inside of another scrollable view brings problems. Maybe that’s why Android provides the component Expandablelistview which is no more than a Listview whose items are…
-
1
votes1
answer52
viewsA: How to continue selecting after onItemLongClick?
If you can already make the selection then: Do the method onItemLongClick() return false. Implement the method onItemClick() passing the code that is on onItemLongClick() and who makes the selection…