IS01で右サイドバーの無いアプリを作成する方法

2010-08-16 16:48 JST by kcrt

 

発売して結構時間がたってるけど誰も書かないので書いちゃう。

IS01はよくあるAndroid端末と違い、特殊な解像度を持っています。一般のソフトウェアに配慮してか、右側にサイドバーが表示されてその全体を使うことは通常できませんでした。

今回のサンプルではそれを回避する方法を書いています。

package com.example.is01.fullscreen;
/*
 * IS01 FullScreen Window Sample
 *      IS01の邪魔なサイドバーを回避するサンプル
 *      Programmed by kcrt <kcrt _atmark_ kcrt.net>
 *          Nanoseconds Hunter "http://www.kcrt.net/"
 * $id:$
 */
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import java.lang.Class;
import java.lang.reflect.Method;

public class StartupActivity extends Activity {
    /** Called when the activity is first created. */
    Method setFullScreenMode;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        try{
            Class<?> sgManager = Class.forName("jp.co.sharp.android.softguide.SoftGuideManager");
            Class<?> paramstype[] = {boolean.class};
            setFullScreenMode = sgManager.getMethod("setFullScreenMode", paramstype);
        }catch(Exception o){
            Log.d("is01fullscreen", "failed" + o.getMessage() + ":" + o.getClass().toString());
        }
    }

    @Override
    public void onResume(){
        super.onResume();
        try{
            setFullScreenMode.invoke(null, true);
        }catch(Exception o){
            Log.d("is01fullscreen", "failed");
        }
    }
}

結論からいうと、jp.co.sharp.android.softguide.SoftGuideManager::setFullScreenMode(true)をonResumeで呼び出してあげる事になります。これタイマーで呼び出したりできないのかな。また試してみよう。

Javaでプログラムを書くのは初めてなのでおかしかったらごめんなさいな。

あ、あとバージョンアップで潰されたらごめんなさい。

zipで欲しい人: IS01FullScreenSample