The Exception Unable to instantiate activity ComponentInfo

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”

How to restore the state of a WebView in a layout “Tabs + Swipe” with ViewPager and FragmentPagerAdapter

In the post Tabs and swipe views Szymon asks how to implement a WebView in order to preserve its state moving from one tab to another in a similar way as explained in How to save the state of a WebView inside a Fragment of an Action Bar. Continue reading “How to restore the state of a WebView in a layout “Tabs + Swipe” with ViewPager and FragmentPagerAdapter”

Drawing a triangle 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”

List of the sensors in an Android device

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”