Results 1 to 8 of 8

Thread: Android app/game tutorial in Urdu noob friendly (with source code)part2

  1. #1
    Hawk82 is offline Member
    Last Online
    22nd November 2014 @ 11:08 AM
    Join Date
    14 Oct 2014
    Gender
    Male
    Posts
    256
    Threads
    18
    Thanked
    29

    Default Android app/game tutorial in Urdu noob friendly (with source code)part2

    So now every thing is ready now you can start developing game

    ok before creating app you need to know something important k kon sy folder main kya kaam hota hai yahan main aapko kuch example dunga

    src: yeh source folder sab sy main hota hai. Sari app ka source code yahan likha hota hai

    res: yeh resources folder hota hai is main aap saray resources daltay hain jaisa k
    anim: Compiled animation files
    drawable: Bitmaps
    layout: UI and view definitions
    values: Arrays,colors, dimensions, strings, and styles
    xml: Compiled arbitrary XML files
    raw: Noncompiled raw files

    Iska structure kuch yun hota hai
    Code:
    /res/values/strings.xml
    /res/values/colors.xml
    /res/values/dimens.xml
    /res/values/attrs.xml
    /res/values/styles.xml
    /res/drawable/*.png *.jpg *.gif *.9.png
    /res/anim/*.xml
    /res/layout/*.xml
    /res/raw/*.*
    /res/xml/*.xml
    /assets/*.*/*.*
    gen: yeh auto generated folder hota hai jab aap dubug krtay hain koi b application to yeh auto generate krta hai files


    Ab aap start krain

    1.Click file--> new --> android application project


    2. Just write the details as written in picture


    3. Then uncheck create custom launcher icon and create activity



    Aap ka project kuch yun ban kar aega aur important chez iski xml file hain Android Manifest.xml



    (Jaisa k mainay aap ko pehly btaya k main is main aapko java nai btaonga is k baad java k b tutorials dunga par abhe sirf code dunga)

    Ab sab sy pehly hum java ka aik package bnaegy java ka package bananay k lye src-->right click-->package uska naam rkhain com.example.hang



    Ab pehlay hum java ki aik class bnaegay main class
    Right click on your package-->new-->class

    class name MainActivity





    Ab yahan sab sy important cheez hai aik baat samajhna k android ki aap chalti kaisay hai,
    Kisi b app main aap aik ya bht sari activities banatay hain kam sy kam aik to hoti hi hai.
    Yeh activities btati hain k aap ki aap kya karay ge jaisa k aik activity app open karnay ki phr agr usay pause karain to kya aur phr usay resume karain to kya hoga yeh sab activities hoti hain, in activities ko aap xml file jo k Androidmanifest.xml hai us main define krtay hain.

    Ab aap ko yeh baat clear hojani chahyeh

    source code /srcfolder main jata hai jo k hum java main bana rahay hain

    uski activities hum androidmanifest.xml main likhaingy

    aur is puri aap k lye jo strings ya bitmaps yani drawables chahyeh hongay woh hum resources /res folder main dalaingay

    Yeh samajh agaya to ab agay chaltay hain

    Code:
    package com.example.hang;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.View;
    
    public class MainActivity extends Activity {
    	
    	public final static String EXTRA_MESSAGE = "com.example.hang.MESSAGE";
    	
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
        
        
        public void startGame(View view) {   
           Intent intent = new Intent(this, LevelSelectActivity.class);
          // EditText editText = (EditText) findViewById(R.id.edit_message);
           //String message = editText.getText().toString();
           //intent.putExtra(EXTRA_MESSAGE, message);
           startActivity(intent);
        }
        
        @Override
    	public void onBackPressed() {
        	Intent intent = new Intent(Intent.ACTION_MAIN);
        	intent.addCategory(Intent.CATEGORY_HOME);
        	intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        	startActivity(intent);
    	}
    }

    aap is java code ko apni MainClass main copy kr lijye or phr ctrl S press krain jo errors hon unhain chor dain kyun k yeh error baki classes k na honay ki wjah sy hain jo hum abhe bnaegay

    ab aap apni androidmanifest.xml kholain aur us main yeh type krain

    Code:
    <activity
                android:name="com.example.hang.MainActivity"
                android:launchMode="singleTop"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    Yeh code aap ny android:theme="@style/AppTheme" > k nichay aur </application> k oper yani in dono k beech main paste krna hai

    yeh code kya keh raha hai aik nazar samajhtay hain

    android:name="com.example.hang.MainActivity" = yeh is main activity ko pehlay run krnay ka keh raha hai

    android:launchMode="singleTop" = single top aur standard main jo fark hai woh technical hai aap ko baad ki classes main smjhaonga

    android:label="@string/app_name" > = hum strings ki aik xml file bnaengay jahan sy yeh code app_name uthaya jaega

    ab aap dobara apnay package com.example.hang par ajaye aur right click kar k aik aur class banaye
    LevelSelectActivity



    java code of class:
    Code:
    package com.example.hang;
    
    import android.os.Bundle;
    import android.app.Activity;
    import android.view.MenuItem;
    import android.view.View;
    import android.support.v4.app.NavUtils;
    import android.annotation.SuppressLint;
    import android.content.Intent;
    
    public class LevelSelectActivity extends Activity {
    
    	@SuppressLint("NewApi")
    	@Override
    	public void onCreate(Bundle savedInstanceState) {
    	    super.onCreate(savedInstanceState);
    	    // Set the text view as the activity layout
    	    setContentView(R.layout.activity_level_select);
    	}
    
    	/**
    	 * Set up the {@link android.app.ActionBar}, if the API is available.
    	 */
    
    	@Override
    	public boolean onOptionsItemSelected(MenuItem item) {
    		switch (item.getItemId()) {
    		case android.R.id.home:
    			NavUtils.navigateUpFromSameTask(this);
    			return true;
    		}
    		return super.onOptionsItemSelected(item);
    	}
    	
    	public void easyStart(View view) {   
    	       Intent intent = new Intent(this, PlayActivity.class);
    	       intent.putExtra("level", 0);
    	       startActivity(intent);
    	}
    	
    	
    	public void hardStart(View view) {   
    	       Intent intent = new Intent(this, PlayActivity.class);
    	       intent.putExtra("level", 1);
    	       startActivity(intent);
    	}
    	
    	
    	public void expertStart(View view) {   
    	       Intent intent = new Intent(this, PlayActivity.class);
    	       intent.putExtra("level", 2);
    	       startActivity(intent);
    	}
    	
    	@Override
    	public void onBackPressed() {
    		Intent intent = new Intent(Intent.ACTION_MAIN);
    		intent.addCategory(Intent.CATEGORY_HOME);
    		intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    		startActivity(intent);
    	}
    
    }
    Yeh code aap paste kar dijye.

    Ab dobara apni androidmanifest.xml ko kholain aur yeh code </activity> aur </application> k beech main paste kar dain

    Code:
    <activity
                android:name="com.example.hang.LevelSelectActivity"
                android:launchMode="singleTop"
                android:label="@string/title_activity_level_select"
                android:parentActivityName="com.example.hang.MainActivity" >
                <meta-data
                    android:name="android.support.PARENT_ACTIVITY"
                    android:value="com.example.hang.MainActivity" />
            </activity>



  2. #2
    Sameer78's Avatar
    Sameer78 is offline Advance Member
    Last Online
    5th June 2021 @ 10:50 AM
    Join Date
    10 Apr 2014
    Location
    Lahore
    Gender
    Male
    Posts
    1,116
    Threads
    11
    Credits
    712
    Thanked
    68

    Default

    Attachement Show nahe ho rahe//

  3. #3
    Hawk82 is offline Member
    Last Online
    22nd November 2014 @ 11:08 AM
    Join Date
    14 Oct 2014
    Gender
    Male
    Posts
    256
    Threads
    18
    Credits
    0
    Thanked
    29

    Default

    Quote Fire Sail said: View Post
    Attachement Show nahe ho rahe//
    woh sari is thread k end main hain Yahan Click krain

  4. #4
    liaqatali111's Avatar
    liaqatali111 is offline Advance Member
    Last Online
    11th January 2024 @ 01:39 PM
    Join Date
    26 Sep 2012
    Location
    @itdunya.com
    Gender
    Male
    Posts
    1,196
    Threads
    177
    Credits
    368
    Thanked
    56

    Default

    Nice sharing i like it

  5. #5
    sham1052's Avatar
    sham1052 is offline Senior Member+
    Last Online
    5th September 2019 @ 07:29 AM
    Join Date
    22 Oct 2015
    Location
    Lahore
    Gender
    Male
    Posts
    175
    Threads
    9
    Credits
    14
    Thanked
    6

    Default

    Thanks Very nice

  6. #6
    ali bashak is offline Junior Member
    Last Online
    8th November 2015 @ 02:37 AM
    Join Date
    19 May 2011
    Age
    31
    Gender
    Female
    Posts
    2
    Threads
    0
    Credits
    0
    Thanked
    0

    Default

    mujha zynga poker ka hack mil skhta hai plzz i m so sad plzz help me

  7. #7
    AwaisKing's Avatar
    AwaisKing is offline Senior Member+
    Last Online
    24th January 2021 @ 03:02 PM
    Join Date
    31 Mar 2012
    Age
    26
    Gender
    Male
    Posts
    857
    Threads
    44
    Credits
    1,146
    Thanked
    105

    Default

    nice tut bro
    No more posting on forums, Facebook and WhatsApp only.

  8. #8
    Join Date
    09 May 2015
    Location
    Kasur,Punjab,
    Gender
    Male
    Posts
    376
    Threads
    65
    Credits
    956
    Thanked
    60

    Default

    Image Show Nhai Ho Rahi Hain

Similar Threads

  1. Replies: 25
    Last Post: 8th November 2015, 02:32 AM
  2. Android Urdu Review, (Android Urdu Article)
    By Afridi in forum Android Zone
    Replies: 106
    Last Post: 17th June 2013, 02:51 PM
  3. Urdu Best Websites Needed
    By mudasar786 in forum Ask an Expert
    Replies: 10
    Last Post: 11th November 2011, 01:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •