10: 2018-01-03 (水) 15:57:17 njf[4] [5] [6] | 現: 2018-01-04 (木) 21:28:37 njf[4] [7] [8] | ||
---|---|---|---|
Line 5: | Line 5: | ||
*プロジェクトの作成 [#v878cca4] | *プロジェクトの作成 [#v878cca4] | ||
まずAndroid Studioでテスト用にAndroidで実行するためのプロジェクトを作成します。 | まずAndroid Studioでテスト用にAndroidで実行するためのプロジェクトを作成します。 | ||
- | Android Studio起動後に「Start a new Android Studio project」を選択します。 | + | 具体的には、ボタンを押すとアラート画面が表示されるアプリです。 |
+ | |||
+ | まずAndroid Studio起動後に「Start a new Android Studio project」を選択します。 | ||
&ref(asstart.jpg,mw:480,mh:360); | &ref(asstart.jpg,mw:480,mh:360); | ||
Line 87: | Line 89: | ||
package njf.jp.anealert; | package njf.jp.anealert; | ||
+ | |||
import android.app.Activity; | import android.app.Activity; | ||
import android.app.AlertDialog; | import android.app.AlertDialog; | ||
+ | |||
public class ANEAlert { | public class ANEAlert { | ||
private Activity activity; | private Activity activity; | ||
Line 105: | Line 107: | ||
alertDialog.show(); | alertDialog.show(); | ||
} | } | ||
+ | |||
} | } | ||
+ | |||
} | } | ||
Line 124: | Line 126: | ||
package njf.jp.anealertsample; | package njf.jp.anealertsample; | ||
+ | |||
import android.support.v7.app.AppCompatActivity; | import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | import android.os.Bundle; | ||
import android.view.View; | import android.view.View; | ||
import android.widget.Button; | import android.widget.Button; | ||
+ | |||
import njf.jp.anealert.ANEAlert; | import njf.jp.anealert.ANEAlert; | ||
+ | |||
public class MainActivity extends AppCompatActivity { | public class MainActivity extends AppCompatActivity { | ||
private ANEAlert aneAlert; | private ANEAlert aneAlert; | ||
Line 139: | Line 141: | ||
super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | setContentView(R.layout.activity_main); | ||
+ | |||
aneAlert = new ANEAlert(this); | aneAlert = new ANEAlert(this); | ||
Button button = (Button) findViewById(R.id.showAlertButton); | Button button = (Button) findViewById(R.id.showAlertButton); | ||
Line 149: | Line 151: | ||
aneAlert.showAlert("Android",alertCounter + " times!"); | aneAlert.showAlert("Android",alertCounter + " times!"); | ||
} | } | ||
+ | |||
} | } | ||
); | ); | ||
+ | |||
} | } | ||
} | } | ||
Line 201: | Line 203: | ||
package njf.jp.anealert; | package njf.jp.anealert; | ||
+ | |||
import com.adobe.fre.FREContext; | import com.adobe.fre.FREContext; | ||
import com.adobe.fre.FREExtension; | import com.adobe.fre.FREExtension; | ||
Line 207: | Line 209: | ||
import java.util.HashMap; | import java.util.HashMap; | ||
import java.util.Map; | import java.util.Map; | ||
+ | |||
public class ANEAlertFREExtension implements FREExtension { | public class ANEAlertFREExtension implements FREExtension { | ||
@Override | @Override | ||
Line 218: | Line 220: | ||
return result; | return result; | ||
} | } | ||
+ | |||
@Override | @Override | ||
public void dispose() { | public void dispose() { | ||
+ | |||
} | } | ||
}; | }; | ||
return context; | return context; | ||
} | } | ||
+ | |||
@Override | @Override | ||
public void dispose() { } | public void dispose() { } | ||
+ | |||
@Override | @Override | ||
public void initialize() { } | public void initialize() { } | ||
Line 240: | Line 242: | ||
package njf.jp.anealert; | package njf.jp.anealert; | ||
+ | |||
import android.app.Activity; | import android.app.Activity; | ||
import android.util.Log; | import android.util.Log; | ||
Line 246: | Line 248: | ||
import com.adobe.fre.FREFunction; | import com.adobe.fre.FREFunction; | ||
import com.adobe.fre.FREObject; | import com.adobe.fre.FREObject; | ||
+ | |||
public class ANEAlertFREFunction implements FREFunction { | public class ANEAlertFREFunction implements FREFunction { | ||
private ANEAlert aneAlert; | private ANEAlert aneAlert; | ||
+ | |||
@Override | @Override | ||
public FREObject call(FREContext freContext, FREObject[] freObjects) { | public FREObject call(FREContext freContext, FREObject[] freObjects) { |
(This host) = https://njf.jp