Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Programming Concept Lesson 1

This lesson explain programming concept in Arabic
by

Eman Mohamed

on 11 December 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Programming Concept Lesson 1

The application should read the RSS feed of a website like this and show it to the user as a list.
How to make android App ?
Basic
MainActivity

The program is sequence of steps
it tell the computer what is the
starting step to take.
The programming is tell the computer what to do.
there is many programming
languages to write program such as python, java , c#,c++.
Android

Application GUI
public class MainActivity extends ListActivity {
//step3 String[] categories ={"First", "Second" , "Three","Four" , "Ali","Shady"}; //step1
List<CategoryInfo> categories ; //step3
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
categories = new MockCategoryRepository().getCategories();//step3
//Note : this class responce for pull data from rss channel create it ??
// if (savedInstanceState == null) {
// getSupportFragmentManager().beginTransaction()
// .add(R.id.container, new PlaceholderFragment())
// .commit();
//}
//use adapter to define list of text which display on the list
setListAdapter(new CategoryAdapter()); //step1
}
//My List //step1
@Override
protected void onListItemClick(ListView l, View v, int position, long id ){
//step2
//handle click event
Toast.makeText(MainActivity.this ,categories[position], Toast.LENGTH_SHORT).show();

};
//step3 class CategoryAdapter extends ArrayAdapter<String>{

class CategoryAdapter extends ArrayAdapter<CategoryInfo>{ //step3
CategoryAdapter(){
super(MainActivity.this, R.layout.category_row, R.id.label, categories);
}
@Override
//template for each row in the list
public getView(int position, View convertView, ViewGroup parent){
LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(R.layout.category_row,parent,false);
//update name of title
TextView lable = (TextView) row.findViewById(R.id.label);
//step3 lable.setText(categories[position]);
lable.setText(categories.get[position].getTitle());

//step3 set image icon
ImageView icon = (ImageView) row.findViewById(R.id.icon);
//icon.setImageResource(R.drawable.rss);
icon.setImageResource(categories.get[position].getImgId());
return (row);
}
}
//----

@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;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch (item.getItemId()) {
case R.id.action_settings:
return true;
}
return super.onOptionsItemSelected(item);
}

/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}
}

}

Computer
program
computer by itself can't do any thing
Computer can do any thing, you programed it
you can turn your computer into {Web browser - server - game playing machine - toaster}
computer can execute a billion of instructions very fast
Computer
Program
Java Language

Objects
Code organize in pieces called object
You can use object written with other people in your program
Class
public class mydate
{
public int day;
public int month;
public int convertMonthToDay(int x)
{
int y = x * 30;
return y;
}
}
mydate obj = new mydate();
int x=obj.convertMonthToDay(2);
Variable

mydate obj = new mydate();
int x=obj.convertMonthToDay(2);
what is the variable name in ex rocket?
picture
rocket
new
what is the variable type in ex rocket?
picture
rocket
new
what is the initial value int rocket =10?
int
rocket
6
int x = 10
x = 20
take position in memory
10
20
Inter face
int dayOld = today.dayfrom (birthday);
what is the argument ?
what is the type of the return value?
Method
int length();
how many parameters ?
what is the type of return value?
string replace(string x, string y);
how many parameters?
what are the parameter types?
what is the type of return value?
void printIn(string output);
how many parameters?
what are the parameter types?
how many return values?
Constructing
http://docs.oracle.com/javase/6/docs/api/java/awt/Rectangle.html
// You need to construct and draw two rectangles for this quiz.
//
// Both rectangles have width 20 and height 30. The first rectangle
// has top left corner at (60, 90). The bottom right corner of the
// first rectangle should be the top left corner of the second
// rectangle.
public class RectangleDemo
{
public static void main(String[] args)
{
// TODO: your code here


}
}

https://www.udacity.com/course/viewer#!/c-cs046/l-161445800/e-161492889/m-164638609
XML was designed to transport and store data. XML stands for EXtensible Markup Language

HTML was designed to display data.
Maybe it is a little hard to understand, but XML does not DO anything. XML was created to structure, store, and transport information.
XML is the most common tool for data transmissions between all sorts of applications.
RSS
What is RSS?
RSS stands for Really Simple Syndication
RSS allows you to syndicate your site content
RSS defines an easy way to share and view headlines and content
RSS files can be automatically updated
RSS allows personalized views for different sites
RSS is written in XML
keep in mind that:

All elements must have a closing tag
Elements are case sensitive
Elements must be properly nested
Attribute values must always be quoted
First, create an RSS document and save it with an .xml extension.
Then, upload the file to your website. Next, register with an RSS aggregator. Each day the aggregator searches the registered websites for RSS documents, verifies the link, and displays information about the feed so clients can link to documents that interests them.
The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document.

The next line is declaration which identifies that this is an RSS document..

The next line contains the <channel> element. This element is used to describe the RSS feed.


The <channel> element has three required child elements:
<title> - Defines the title of the channel (e.g. W3Schools Home Page)
<link> - Defines the hyperlink to the channel (e.g. http://www.w3schools.com)
<description> - Describes the channel (e.g. Free web building tutorials)
Each <channel> element can have one or more <item> elements.
Each <item> element defines an article or "story" in the RSS feed.
The <item> element has three required child elements:
<title> - Defines the title of the item (e.g. RSS Tutorial)
<link> - Defines the hyperlink to the item (e.g. http://www.w3schools.com/rss)
<description> - Describes the item (e.g. New RSS tutorial on W3Schools)
Finally, the two last lines close the <channel> and <rss> elements.
An android application with 2 types of pages:-
1. List of all news “showing only titles and dates of the news”.
2. Page of the selected item from the previous list shows the whole item “Title ,Date ,Image and Description”
Android RSS Reader
Bonus
- Adding splash screen “starting page” and animations to list items
- Adding Loading Notation while getting data from Internet.
Package :
A Java package is a mechanism for organizing Java classes into namespaces
package java.awt.event;
import java.awt.event.*;
Using
Activity Name:
Name of enter point of the application as Main()
Open source mobile operating system
App development uses the java languages
http://www.slideshare.net/MikeKvintus/intro-to-android-app-development
Action Bar : the most important actions for the current view
simple controls for switching between views
Navigation Drawer
Content Area
1- App Icon
2- View Content
3- Action Button
4- Action Overflow
UI design
Action Bar : Bottom Bar
Action Bar : Main action bar
Tabs
Scrollable
Fixed
Lists
Grid Lists
Buttons
Image
Text
Text & Image
Dialogs
Alerts
Popups
Toasts
Application Components
Activity
BroadcastReceiver
Service
ContentProvider
UI component typically corresponding to one screen
Responds to notifications or status changes. Can wake up your process
Faceless task that runs in the background.
Enable application to share data.
An activity represents a single screen with a user interface
EX: an email application might have one activity that shows a list of new emails
it might initiate a service to perform some work based on the event.
Ex: a service might play music in the background while the user is in a different application
Content providers are also useful for reading and writing data that is private to your application and not shared. For example, the Note Pad sample application uses a content provider to save notes.
Splash screen
List View
click individual row
First Screen
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/header_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:padding="5px"
android:layout_gravity="left"/>
<TextView
android:id="@+id/sp_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5px"
android:background="@color/sp_bg_color"
android:textColor="@color/sp_text_color"
android:textStyle="bold"
android:text="@string/hd_sp"/>
<TextView
android:id="@+id/selection"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ListView
android:id="@+id/rss_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></ListView>


</LinearLayout>

1- fragment_main.xml
2- Create colors.xml under values folder
<resources>
<color name="dark_grey">#2d2d2d</color>
<color name="sp_bg_color">#525252</color>
<color name="sp_text_color">#ffffff</color>
</resources>
To represent selection when users select something
3- add in strings.xml
<string name="app_name">News Reader</string>
<string name="action_settings">Settings</string>
<string name="hd_sp">Today News</string>
4- MainActivity.java
public class MainActivity extends ActionBarActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
}
tell which layout will render
import android.app.ListActivity;
public class MainActivity extends ListActivity
String[] categories ={"First", "Second" , "Three","Four" , "Ali","Shady"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//use adapter to define list of text which display on the list
setListAdapter(new CategoryAdapter()); //step1
}
//My List //step1
@Override
protected void onListItemClick(ListView l, View v, int position, long id ){
//handle click event
Toast.makeText(MainActivity.this ,categories[position], Toast.LENGTH_SHORT).show();
};
class CategoryAdapter extends ArrayAdapter<String>{
CategoryAdapter(){
super(MainActivity.this, R.layout.category_row, R.id.label, categories);
}
@Override
//template for each row in the list
public View getView(int position, View convertView, ViewGroup parent){
LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(R.layout.category_row,parent,false);
//update name of lable
TextView lable = (TextView) row.findViewById(R.id.label);
lable.setText(categories[position]);
return (row);
}
}
step 1
Step2 create Layout
category_row.xml under layout folder
Categories List
Image
Title
Description
Links
1- Create new package called : com.models
2- create class called:
CategoryInfo
connect item_Layout with List ListView
Thank you
My references :
www.udacity.com
www.wikipedia.org
http://developer.android.com
Full transcript