AboutDialog.java
Go to the documentation of this file.
00001 
00005 package com.introlab.rtabmap;
00006 
00007 import java.io.BufferedReader;
00008 import java.io.IOException;
00009 import java.io.InputStream;
00010 import java.io.InputStreamReader;
00011 import android.app.Dialog;
00012 import android.content.Context;
00013 import android.graphics.Color;
00014 import android.os.Bundle;
00015 import android.text.Html;
00016 import android.text.util.Linkify;
00017 import android.widget.TextView;
00018 
00019 public class AboutDialog extends Dialog{
00020 
00021         private static Context mContext = null;
00022         
00023         public AboutDialog(Context context) {
00024                 super(context);
00025                 mContext = context;
00026         }
00027         
00031         @Override
00032         public void onCreate(Bundle savedInstanceState) {
00033                 setContentView(R.layout.about);
00034                 TextView tv = (TextView)findViewById(R.id.info_text);
00035                 tv.setText(Html.fromHtml(readRawTextFile(R.raw.info)));
00036                 tv.setLinkTextColor(Color.WHITE);
00037                 Linkify.addLinks(tv, Linkify.ALL);
00038         }
00039         
00040         public static String readRawTextFile(int id) {
00041                 InputStream inputStream = mContext.getResources().openRawResource(id);
00042         InputStreamReader in = new InputStreamReader(inputStream);
00043         BufferedReader buf = new BufferedReader(in);
00044         String line;
00045         StringBuilder text = new StringBuilder();
00046         try {
00047                 while (( line = buf.readLine()) != null) text.append(line);
00048          } catch (IOException e) {
00049             return null;
00050          }
00051          return text.toString();
00052      }
00053 
00054 }


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sat Jul 23 2016 11:44:15