Support forums > Tips, tricks, and tutorials

[Tutorial] How to create android mobile app for your Osclass website!

(1/16) > >>

qaximor:
It's really easy and you don't need any prior Java or Android development knowledge.

What you need is:
Eclipse
Java SDK
Android SDK
(I won't be getting into how to download and install them, please look for a tutorial on the internet there is a lot of them trust me!)
Mobile Plugin from the Plug in market to force mobile devices to go to the mobile version and if your theme already has mobile version supported then you don't need to install it.

So what you need is 3 codes to copy and paste, THAT'S IT.

First code you need to past in your activity_main.xml

--- Code: ---<?xml version="1.0" encoding="utf-8"?>
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
          android:theme="@android:style/Theme.NoTitleBar"
          android:id="@+id/webview"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:scrollbars="none"/>
--- End code ---

Second code you need to paste in your MainActicity class (Don't forget to edit your package name above! If you are not sure just copy paste as it is and then ALT+ENTER and eclipse will edit and write your package name.

--- Code: ---package YOUR_PACKAGE_NAME_HERE;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.example.esouqbh.esouq.R;

public class MainActivity extends Activity
{@Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //Remove title bar as we already have it in the web app
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    //Point to the content view defined in XML
    setContentView(R.layout.activity_main);
    //Configure the webview setup in the xml layout
    WebView myWebView = (WebView) findViewById(R.id.webview);
    WebSettings webSettings = myWebView.getSettings();
    //Yes, we want javascript, pls.
    webSettings.setJavaScriptEnabled(true);
    //Make sure links in the webview is handled by the webview and not sent to a full browser
    myWebView.setWebViewClient(new WebViewClient());
    //And let the fun begin
    myWebView.loadUrl("http://YOURWEBSITEURLHERE.com");    }}

--- End code ---
NOTE: change http://YOURWEBSITEURLHERE.com to your website URL.

Third code you need to paste in AndroidManifest.xml is

--- Code: ---  <uses-permission android:name="android.permission.INTERNET"></uses-permission>
--- End code ---
Paste it right before </manifest>

Guess what? That's it! You just made your Osclass website into an android app!

cyrano:
That's great!

Would this also work with Android Studio?

qaximor:
Yes of course!

bengalliboy:
What about a native apk for android? Going to mysql directly??

creat15:
Hi :)

nice tutorial :)

i want to ask, I've tried the tutorial of your work but on the uploaded image to the new ads can not, how to be able to upload an image from android?

then how to keep uploading images of android can choose an image from the camera or gallery

Navigation

[0] Message Index

[#] Next page

Go to full version