how would you rate The Holy Qura'an - Arabic ver?

Thursday, June 3, 2010

The Holy Qura'an


Update June 09, 2010

OK, so yesterday I uploaded my demo for The Holy Quraan on Android Market. My idea in making my apps is to make is as straightforward and easy as I could, I call this method LEC (Life Experience Computerization). You open a book and you want to jump to a specific page and start reading. You don't read the intro and bio pages every time you open your book. So this is why I build my apps like that. "just saying this 'cause I got a comment about this from one friend :) you know who you are

So, lets start, getting my app to jump to a specific page was a bit challenging. I use a gallery to show all the pages. The main menu is connected to all this pages and that's why you could jump to a specific Sora from the main menu and still could flip to all the other pages from that page.
At this point, I will omit the zoom function as a friend suggested and will focus on making the full version available. Options menu will be added in the next update.

Challenges I faced:
1. Enlarging images in my gallery to fit the screen.
2. Zooming .. still not sure how handle it perfectly.
3. Connecting main menu to point to a page in the gallery

OK, how does the gallery work?
First, lets say you have Screen1.java has a list of buttons one of them is related to btn1 in your Screen1.xml then Screen1.java should look something like this
public void onCreate(Bundle savedInstanceState) {

Button A = (Button) findViewById(R.id.btn1);
A.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i = new Intent(Screen1.this, Screen2.class);
int Str = 1;
i.putExtra("PASS", Str);
Notice you are passing "PASS=1" to Screen2.java where you will establish your gallery. Screen2.java should look like this:
public class Screen2 extends Activity
//---the images to display---
Integer[] imageIDs = {
R.drawable.Img0, //0
R.drawable.bgrd1 //1
public void onCreate(Bundle savedInstanceState)
Gallery gallery = (Gallery) findViewById(R.id.gallery1);
gallery.setAdapter(new ImageAdapter(this));

public class ImageAdapter extends BaseAdapter
private Context context;
private int itemBackground;
public ImageAdapter(Context c)
context = c;
//---setting the style---
TypedArray a = obtainStyledAttributes(R.styleable.Gallery1);
itemBackground = a.getResourceId(
R.styleable.Gallery1_android_galleryItemBackground, 0);
//---returns the number of images---
public int getCount() {
return imageIDs.length;
//---returns the ID of an item---
public Object getItem(int position) {
return position;
public long getItemId(int position) {
return position;
//---returns an ImageView view---
public View getView(int position, View convertView, ViewGroup parent) {

ImageView imageView = new ImageView(context);
imageView.setLayoutParams(new Gallery.LayoutParams(150, 120));
return imageView;
Notice three things,
1. The array of images you want to show is placed at the beginning of your class
2. your layout here is Screen2.xml
3. you must add ImageAdapter

Also, Screen2.xml should include your [Gallery android:id="@id/gallery1"/]

So this is basically how you set up your gallery.



This is my new attempt to build an android app. This one will be fully released on android 2.2 due to the fact that the size will be HUGE. Some of the functionalities are:
1. Flipping pages by scrolling right and left.
2. Zooming to the page by clicking on it.
3. A list for all Soras to select from.

hmmmm what else!!!
More details about my progress will be posted soon.

No comments:

Post a Comment