10: 2018-01-03 (水) 15:57:17 njf  |
現: 2018-01-04 (木) 22:28:37 njf  |
| | *プロジェクトの作成 [#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); |
| | | | |
| | 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; |
| | alertDialog.show(); | | alertDialog.show(); |
| | } | | } |
| | + | |
| | } | | } |
| | + | |
| | } | | } |
| | | | |
| | | | |
| | 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; |
| | 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); |
| | aneAlert.showAlert("Android",alertCounter + " times!"); | | aneAlert.showAlert("Android",alertCounter + " times!"); |
| | } | | } |
| | + | |
| | } | | } |
| | ); | | ); |
| | + | |
| | } | | } |
| | } | | } |
| | | | |
| | 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; |
| | 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 |
| | 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() { } |
| | | | |
| | package njf.jp.anealert; | | package njf.jp.anealert; |
| | + | |
| | import android.app.Activity; | | import android.app.Activity; |
| | import android.util.Log; | | import android.util.Log; |
| | 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) { |