6. MasterOS (M) (1420) [off]
|
TXT |
29| 21 Sep 2018, 14:18
Demak boshlaymiz.
Avvalo Adobe flash bu-.swf fayl bo'lib u yordamida internet uchun o'yin va dasturlar yaratiladi.Bu faylni ochish uchun maxsus Flash playerlar bo'lishi kerak bo'ladi.
Sizning kompingizda Android Studio,swf formatda o'yin, 72x72,96x96 o'lchamda iconka(rasm).png va Test uchun Android 2.2+ kerak bo'ladi.
Agar sizda PC yo'q bo'lsa unda AIDE bo'lishi kerak.
1) Android Studio >File>New>Android Project
1.1) AIDE>Create new project>Example>com.mycompany.example>
2) Icon.png ni drawable papkasiga joylashtiramiz.Keyin res>layout>main.xml faylini yaratamiz va uni ichiga:
<?xml version="1.0"encoding="utf-8"?>
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="
@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
yozamiz va saqlaymiz.
3) src>com.mycompany.example>exampleapp.javani ochamiz va shu kodni yozamiz:
package com.somedomain.MyGame;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.webkit.WebView;
public class MyGameActivity extendsActivity { WebView mWebView;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setjаvаsсriрtEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setBackgroundColor(Color.parseColor("
#000000"));
mWebView.loadUrl("file:///android_asset/game.swf");
}
}
4) AndroidManifest.xml ga:
<?xml version="1.0"encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.somedomain.MyGame"android:versionCode="1"android:versionName="1.0"><uses-sdk android:minSdkVersion="8"/><applicationandroid:icon="
@drawable/ic_launcher"android:label="@string/app_name"><activityandroid:screenOrientation="landscape"android:label="@string/app_name"android:name=".MyGameActivity"androidheme="@android:style/Theme.NoTitleBar.Fullscreen"><intent-filter ><action android:name="android.intent.action.MAIN"/><category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
kodni yozamiz.
5) Compilyatsiya qilamiz
5.1) AIDE da Run orqali kompilyatsiya qilinadi.
6) Tayyor bo'lgan Game.apk ni telga o'rnatamiz.Tayyor.
Swf ni Apk ga aylantirishni ikkinchi turini keyingi safar yozaman.