开发者

Android Activity To Mimic a Manual

Can someone point me in the right direction - I'm trying to create an Android Activity that looks like a technical manual that ALSO can take some user input(I know how to do simple buttons etc.) and the user input part can wait until I have a few basic pages.

My goal (开发者_开发问答if possible) would be to create a text-heavy activity (like a technical manual) but I'm not sure what the best GENERAL method is for doing this.

To start - rather than having multiple activities I want one large activity that a User may be able to swipe through from left to right (Perhaps use ViewFlipper here??)

But how can I make an Activity that looks like a manual or is Text Heavy??

Thanks!


This is what I did with my application's instructions. I started with ViewFlipper that has next and back buttons. Then as the application grew in size, code got messier and there are a lot of formatting that I needed for the text. So I turned to use WebView and just store the text files as raw assets.

WebView manual=new WebView();
manual.loadData(Utilities.getData(this, R.raw.update),"text/html", "utf-8");

getData method:

    public static String getData(Context c,int res) throws IOException{
        InputStream ins = c.getResources().openRawResource(res);
        byte[] buffer = new byte[ins.available()];
        ins.read(buffer);
        ins.close();
        String html=new String(buffer);
            StringBuilder buf = new StringBuilder(html.length());
        for (char c1 : html.toCharArray()) {
            switch (c1) {
               case '#':  buf.append("%23"); break;
               case '%':  buf.append("%25"); break;
               case '\'': buf.append("%27"); break;
               case '?':  buf.append("%3f"); break;                
               default:   buf.append(c1);
               break;
             }
        }
        return buf.toString();
    }

Then you can attach buttons either to the webview or the application in response to user inputs and load new views.

Advantage: 1. Easy to format and integrate with Android. Very quick development. 2. No need to worry about the view flipper bugs that happens sometimes. 3. It will look like you want.

Disadvantage: 1. Doesn't look too much like an Android Application by itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜