If you need to display rich text in your iOS application, the easiest way is to use a UIWebView for this. If you have only one or two links in a text, activating link detection in a UITextView might be the fastest way. However, you not always want to display the full link to the user or you might want to structure the text with headings or colors etc. In all these cases, the UIWebView gives you the full power of HTML.
Since integrating the UIWebView is not straight forward for all features, you can find here a summary on how to accomplish this.
Using UIWebView for displaying Rich Text weiterlesen
If you just want to have the camera preview data under Android without displaying the preview on the screen the problem is that you have to provide a surface to the Camera object for displaying the preview. On some devices it works without, but even the documentation states that you need to to set a preview surface for the camera to work.
Since I did not want to display the real data but only the processed data on the activity, I needed a solution for this problem. My first try was to include a hidden SurfaceView in the layout, but the SurfaceView does not create a surface if it is not visible. This post provided the first hint for solving the problem: You have to include a surface view and set the layout_height and layout_width parameters to „0dip“. This will trigger creation of the surface but the surfave view is virtually invisible.
Unfortunately, when trying this solution with different devices, it turned out that it does not work correctly on all devices. On some devices the SurfaceView need to have visible size to make the camera preview work.
Finally, what worked on all devices is to overlay the SurfaceView completely with one or more other views so that it is logically visible but the user can not see it. In this way you can easily draw you own processed preview data in a custom view that is hiding the real preview.
Additionally important for further processing of the image data or if you want to display your own preview is that the camera data you get in your preview callback is normally not in RGB but YUV format. If you want to draw the image on a Canvas, you first have to convert the data to RGB, e.g. by using the method you can find described in this post of the Android Developer Forum.
(Interesting sidenote: the YUV format contains the grayscale image in the first width*heigth bytes, so if you just need a grayscale image, no conversion is needed).
Up from API level 8 there is also a YUVImage which you can use to convert the provided data to RGB, see stackoverflow for an example.