Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code syntax highlighting to Readme #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ First you need to install **host.apk** on your phone (or you can build the Host
Also you need to make sure the Android SDK and Ant is installed and android-sdk/tools, android-sdk/platform-tools, ant is in your **PATH**.

Run the following commands:

chmod +x tools/update.sh
tools/update.sh workspace
cd workspace
ant run

```bash
chmod +x tools/update.sh
tools/update.sh workspace
cd workspace
ant run
```
If it shows "device not found", make sure your phone is connected or simulator is running. "adb devices" will tell.

Since we don't specific a default entry in **workspace.properties**, it will popup a window and let you choose one. I suggest bitmapfun.
Expand All @@ -42,10 +42,10 @@ See the [HelloFragment.java](https://github.com/mmin18/AndroidDynamicLoader/blob
Since we use Fragment as UI container, each page is implemented in Fragment instead of Activity. So how do we start a new page?

We use URL, just like a browser does. For instance, in a browser, we open `http://mydomain.com/helloworld.html`. In plugins, we open `app://helloworld`.

```java
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("app://helloworld"));
startActivity(i);

```
Each host is mapped to a single fragment, you define the url mapping table in **project/fragment.properties**.

See the [helloworld fragment.properties](https://github.com/mmin18/AndroidDynamicLoader/blob/master/workspace/sample.helloworld/fragment.properties) sample.
Expand All @@ -57,24 +57,24 @@ In the plugins, we pack resources and codes in the same package. We use R.java a
But instead of using **context.getResources()**, we use **MyResources.getResource(Me.class)** to get the resources which in the same package as **Me.class**.

Here is a sample in HelloFragment.java
```java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

// MyResources manages the resources in specific package.
// Using a Class object to obtain an instance of MyResources.

// In this case, hello.xml is in the same package as HelloFragment class
// MyResources manages the resources in specific package.
// Using a Class object to obtain an instance of MyResources.

MyResources res = MyResources.getResource(HelloFragment.class);
// In this case, hello.xml is in the same package as HelloFragment class

// Using MyResources.inflate() if you want to inflate some layout in
// this package.
return res.inflate(getActivity(), R.layout.hello, container, false);
MyResources res = MyResources.getResource(HelloFragment.class);

}
// Using MyResources.inflate() if you want to inflate some layout in
// this package.
return res.inflate(getActivity(), R.layout.hello, container, false);

}
```
You can use MyResources to get drawable, string, or inflate layout.

## Folders
Expand Down