Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts
Saturday, February 14, 2015
WordPress Installation Tutorial How to Install WordPress

You just need to follow these steps to install WordPress:
Step 1. Download the latest version of WordPress
Step 2. Upload the downloaded WordPress files to your Server
Step 3. Create MySQL Database for you WordPress usage
Step 4. Just install your wordpress
Now in Detail: How to Install WordPress Step by Step Guide
Step 1. Download the latest version of WordPress
You just need to Download the WordPress from its official Site: www.WordPress.org
Step 2: Upload the downloaded WordPress files to your Server
The easy way to upload your files to your FTP Server is via FTP software: like FileZilla, Cute FTP and Smart FTP but i prefer FileZilla because it is easy to use. For detail How to upload WordPress to FTP.......!

Step 3: Create MySQL Database for you WordPress usage
Now you just need to create MySQL database for assign a user to it with full permission. For detail How to Create MySQL database and user. for example

Step 4: Install your WordPress
Now this is the time to install your WordPress Go to http://youromain.com or if nothing appeared then enter this url to your browser http://yourdomain.com/wp-admin/ and this screen will appeared and click on Create a Configuration File



After fulling above form click in Submit button and below screen will appeared and click on Run the install button




I hope you like it..........!
Wednesday, February 4, 2015
Android beginner tutorial Part 7 LinearLayout container
Today well take a look at the LinearLayout container.
The LinearLayout container stacks its children either horizontally or vertically, one after another. To set the orientation, you need to use the android:orientation attribute of the tag.
Lets edit the code from our previous tutorial to create an Activity layout which consists of a LinearLayout with horizontal orientation and 3 children. Set the width and height of the layout tag to match_parent, and set each buttons width and height to wrap_content:
The results:

Lets see what happens if we set orientation to vertical:
Results:

You can also use a very useful attribute called layout_weight for children of a LinearLayout.
This attribute basically sets the priority level for this child. The values for this attribute are numbers. The whole weight system is comparable to a cooking recipe, for example: 3 parts of milk and 2 parts of ice cream. This means that in the final product there will be 60% milk and 40% ice cream.
If we use a horizontal linear layout, we can use the layout_weight attribute to make interface elements flex depending on the device screen size. Heres an example, which gives the first button 1/6 of the total width, the second button 1/3 (2/6) of the width and the third button 1/2 (3/6) of the whole row width.
The results:

You can also use LinearLayouts inside other LinearLayouts. Heres an example:
Results:

Thats all for today!
Thanks for reading!
Read more »
The LinearLayout container stacks its children either horizontally or vertically, one after another. To set the orientation, you need to use the android:orientation attribute of the tag.
Lets edit the code from our previous tutorial to create an Activity layout which consists of a LinearLayout with horizontal orientation and 3 children. Set the width and height of the layout tag to match_parent, and set each buttons width and height to wrap_content:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity" >
<Button
android:text="Test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 3" />
</LinearLayout>
The results:

Lets see what happens if we set orientation to vertical:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<Button
android:text="Test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 3" />
</LinearLayout>
Results:

You can also use a very useful attribute called layout_weight for children of a LinearLayout.
This attribute basically sets the priority level for this child. The values for this attribute are numbers. The whole weight system is comparable to a cooking recipe, for example: 3 parts of milk and 2 parts of ice cream. This means that in the final product there will be 60% milk and 40% ice cream.
If we use a horizontal linear layout, we can use the layout_weight attribute to make interface elements flex depending on the device screen size. Heres an example, which gives the first button 1/6 of the total width, the second button 1/3 (2/6) of the width and the third button 1/2 (3/6) of the whole row width.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity" >
<Button
android:text="Test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 2"
android:layout_weight="2"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 3"
android:layout_weight="3"/>
</LinearLayout>
The results:

You can also use LinearLayouts inside other LinearLayouts. Heres an example:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:text="Test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 2"
android:layout_weight="2"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 3"
android:layout_weight="3"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:text="Test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test 2"
android:layout_weight="2"/>
</LinearLayout>
</LinearLayout>
Results:

Thats all for today!
Thanks for reading!
Monday, February 2, 2015
Android beginner tutorial Part 39 Custom Toast notifications
In this tutorial we will learn how to create our own custom Toast notifications.
The activity_main.xml Activity layout will remain the same as in the previous tutorial:
To create a custom Toast, we need to write a layout xml for it. We can then apply it to a Toast using a LayoutInflater.
Create a new layout xml file. If youre using Eclipse IDE, go to File > New > Android XML File. Call the file custom_toast.xml.
Inside the layout Im going to make a simple LinearLayout container, which contains an ImageView and a TextView. Remember to give the container an id. Set the src of the ImageView to a picture in your project (I set it to the ic_launcher.png picture). Give an id to the TextView.
Now we need to apply this layout to the Toast notification. As I said before, well need to use a LayoutInflater class instance to do that. An inflater can extract layouts from XML files and lets us work with them using code. To extract the layout, we need to declare an inflater and then call its inflate() function. Provide the layout resource and the id of the main container in that layout:
Set the text by refering to the "text" TextView inside the layout:
The rest of the code simply creates the Toast and sets its values. Use setView() method to apply the layout.
Here is the full MainActivity.java class code:
The results look like this:

Thanks for reading!
Read more »
The activity_main.xml Activity layout will remain the same as in the previous tutorial:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<Button
android:id="@+id/testButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Make a toast"
/>
</LinearLayout>
To create a custom Toast, we need to write a layout xml for it. We can then apply it to a Toast using a LayoutInflater.
Create a new layout xml file. If youre using Eclipse IDE, go to File > New > Android XML File. Call the file custom_toast.xml.
Inside the layout Im going to make a simple LinearLayout container, which contains an ImageView and a TextView. Remember to give the container an id. Set the src of the ImageView to a picture in your project (I set it to the ic_launcher.png picture). Give an id to the TextView.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="10dp"
android:background="#333"
android:id="@+id/toast_layout" >
<ImageView android:id="@+id/image"
android:src="@drawable/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp" />
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textColor="#FFF" />
</LinearLayout>
Now we need to apply this layout to the Toast notification. As I said before, well need to use a LayoutInflater class instance to do that. An inflater can extract layouts from XML files and lets us work with them using code. To extract the layout, we need to declare an inflater and then call its inflate() function. Provide the layout resource and the id of the main container in that layout:
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast, (ViewGroup) findViewById(R.id.toast_layout));
Set the text by refering to the "text" TextView inside the layout:
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Hello from KirCode!");
The rest of the code simply creates the Toast and sets its values. Use setView() method to apply the layout.
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
Here is the full MainActivity.java class code:
package com.kircode.codeforfood_test;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity{
private Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button)findViewById(R.id.testButton);
context = getApplicationContext();
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast, (ViewGroup) findViewById(R.id.toast_layout));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Hello from KirCode!");
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
The results look like this:

Thanks for reading!
Subscribe to:
Posts (Atom)