How to update a TextView inside a loop or, more generally, how to update frequently an UI element of an Activity. Continue reading “Updating frequently a TextView inside a loop”
If you have this error “Unable to instantiate activity ComponentInfo” in the LogCat of Android just you launch your app, first you have to check the file AndroidManifest.xml especially the code lines
- package="[your package]"
it is an attribute of the tag manifest and you insert a unique name for your app in java package style, for example com.example.myapp (see here)
- android:name=".[your activity]"
it is an attribute of the tag activity and you insert the class name that implements the activity (see here)
Continue reading “The Exception Unable to instantiate activity ComponentInfo”
In the post Tab Layout in Android with ActionBar and Fragment as dnoray wrote in his comment, there is a problem: when you rotate the screen (ctrl + F11 in the emulator) there is an overlap of the two fragments as seen in the figure.
For a further discussion on this topic you can read this.
Continue reading “ActionBar, Fragment and screen rotation”
In the post Drawing a triangle with OpenGL ES in Android I explained how to draw a triangle without setting the colors, indeed, the triangle is gray.
In this post I add a few lines of code that allow you to change the color of the triangle starting from the code in Drawing a triangle with OpenGL ES in Android. Continue reading “Adding colors with OpenGL ES in Android”
The scope of this post is drawing a triangle with OpenGL ES 1.x in Android focusing especially on the relationship between code and position of the triangle.
The coordinate system has the origin where the observer is, with the x axis horizontal and rightward, the y-axis vertical and upward and the z axis points so that the observer is looking towards the negative z, then the coordinate system follows the right-hand rule.
The 3 vertices of the triangle have coordinates:
- A(-0.5, -0.29, -10)
- B(+0.5, -0.29, -10)
- C(0, +0.58, -10)
that are the vertices of an equilateral triangle with the barycenter in (0, 0, -10). Continue reading “Drawing a triangle with OpenGL ES in Android”
The idea for this post came to me after reading the comment of Esthon Wood: “do you have any idea on how to save the state of the WebView? I mean, the webview refreshes everytime I tap on the tab.” in the post Tab Layout in Android with ActionBar and Fragment. Continue reading “How to save the state of a WebView inside a Fragment of an Action Bar”
In the post Tab Layout in Android with ActionBar and Fragment I wrote an example about tabs in an action bar where each label open a fragment that you can not change at runtime.
In this post I explain how to replace a fragment with an other using a button. Continue reading “How to replace a Fragment in an ActionBar in mode NAVIGATION_MODE_TABS”
From the release Android SDK Tools 21 a warning fills the logcat:
Unexpected value from nativeGetEnabledTags: 0
I hope it will be fixed in the next release, waiting a solution I found this workaround.
This is a simple app that displays all the sensors in the phone reporting the following characteristics:
- Name: name of the sensor
- Version: version of the sensor’s module
- Vendor: vendor of this sensor
- Type: type of this sensor
- Max Range: maximum range of the sensor
- Resolution: resolution of the sensor
- Min Delay: minimum delay allowed between two events (equals to zero if this sensor only returns a value when the data it’s measuring changes)
- Power: the power of the sensor
Continue reading “List of the sensors in an Android device”