Webツール/ブラウザツール よく使うツールリンク集

■JsonParserOnline

利用目的:Json形式データのパース

json.parser.online.fr

 

■DHC Chromeプラグイン

利用目的:APIの実行テスト

chrome.google.com

 

■SimpleWebSocket

利用目的:Webソケット コマンドテスト

chrome.google.com

 

■AwsomeScreenShot

利用目的:ブラウザ画面のキャプチャ

スクロールのある画面でもスクロールの一番上から下までを一枚の画像にしてくれる

chrome.google.com

Android開発 SharedPreferencesの取得と保存

 

プリファレンスの取得と保存

 

//プリファレンスの取得
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);

//値の受け取り
String val = pref.getString("Key_Name", "DefaultVal");

//値の保存
SharedPreferences.Editor editor = pref.edit();
editor.putString("Key_Name", "InputVal");
editor.apply();

Android開発 画面の向きの取得 画面の向きの固定

■画面の向きを取得 画面の向きによる処理の分岐
・クラスに記載

Resources res = getResources();
Configuration conf = res.getConfiguration();
if(conf.orientation == Configuration.ORIENTATION_PORTRAIT) {
  //縦画面の時の処理
}else if(conf.orientation == Configuration.ORIENTATION_LANDSCAPE){
   //横画面の時の処理
}

■画面の向きの固定
・ManifestのActivity属性に記載する場合

縦画面固定

android:screenOrientation="portrait"

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

横画面固定

android:screenOrientation="landscape"

・クラスに記載する場合

縦画面固定

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

横画面固定

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

Android開発 URLスキーム起動(スキーマ起動)

スキーム起動されるアプリでの設定
・Manifestの起動させたいアクティビティ定義に記載する

<activity android:name=".MainActivity">
    <intent-filter> 
       <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="[スキーマ名]" android:host="[ホスト名]" />
    </intent-filter></activity>

スキーム起動するアプリの設定

Uri uri = Uri.parse("[スキーマ名]://[ホスト名]");
Intent i = new Intent(Intent.ACTION_VIEW, uri);
  try {    
  startActivity(i);
} 
catch (ActivityNotFoundException activityNotFound) {}

Android開発 Activityの移動

【手順】
1.遷移先Activityの作成

2.遷移先レイアウトファイル作成

3.AndroidManifest.xmlに新規Activityの登録

 <activity
    android:name=".[新規アクティビティ名]"
    android:label="@string/app_name" >
 </activity>


4.遷移元のレイアウトにボタンとOnclick時の関数指定

 <Button
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="遷移!"
  android:onClick="[遷移のための関数名]"
  android:id="@+id/button" />


5.遷移元ActivityにOnclick時の関数定義

 public void [遷移のための関数名](View view){
  Intent intent = new Intent();
  intent = new Intent(this, [遷移先アクティビティ].class);
  startActivity(intent);
 }