MY mENU


Sunday 19 August 2012

View Pager Example in Android Development


This example shows how you can create an image pager in android.
Algorithm:
1.) Create a new project by File-> New -> Android Project name it ViewPagerExample.
2.) Write following into main.xml:
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
         />
</LinearLayout>
3.) Create and write following into res/layout/details.xml:
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="vertical" >
    <TextView
        android:id="@+id/detailsText"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal|center_vertical"
        android:layout_marginTop="20dip"
        android:text="Large Text"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="30dip" />
</LinearLayout>
4.) Create and write following into res/layout/details.xml:
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="vertical" >
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/ic_launcher" />
</LinearLayout>
5.) Create and Write following into src/DetailFragment.java:
package com.example.viewpagerexample;
import com.example.viewpagerexample.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class DetailFragment extends Fragment {
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                Log.e("Test""hello");
        }
        @Override
        public void onActivityCreated(Bundle savedInstanceState) {
                super.onActivityCreated(savedInstanceState);
        }
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                        Bundle savedInstanceState) {
                View view = inflater.inflate(R.layout.details, container, false);
                TextView textView = (TextView)view.findViewById(R.id.detailsText);
                textView.setText("Testing");
                return view;
        }
}
6.) Create and Write following into src/ImageFragment.java:
package com.example.viewpagerexample;
import com.example.viewpagerexample.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class ImageFragment extends Fragment {
        private final int imageResourceId;
        public ImageFragment(int imageResourceId) {
                this.imageResourceId = imageResourceId;
        }
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                Log.e("Test""hello");
        }
        @Override
        public void onActivityCreated(Bundle savedInstanceState) {
                super.onActivityCreated(savedInstanceState);
        }
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                        Bundle savedInstanceState) {
                View view = inflater.inflate(R.layout.image_layout, container,false);
                ImageView imageView = (ImageView)view.findViewById(R.id.imageView1);
                imageView.setImageResource(imageResourceId);
                return view;
        }
}
7.) Run for output.
Steps:
1.) Create a project named ViewPagerExample and set the information as stated in the image.
Build Target: Android 4.0
Application Name: ViewPagerExample
Package Name: com. example. ViewPagerExample
Activity Name: ViewPagerExample
Min SDK Version: 8
2.) Open ViewPagerExample.java file and write following code there:
package com.example.viewpagerexample;
import com.example.viewpagerexample.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
public class ViewPagerExample extends FragmentActivity {
        private MyAdapter mAdapter;
        private ViewPager mPager;
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                mAdapter = new MyAdapter(getSupportFragmentManager());
                mPager = (ViewPager) findViewById(R.id.pager);
                mPager.setAdapter(mAdapter);
        }
        public static class MyAdapter extends FragmentPagerAdapter {
                public MyAdapter(FragmentManager fm) {
                        super(fm);
                }
                @Override
                public int getCount() {
                        return 3;
                }
                @Override
                public Fragment getItem(int position) {
                        switch (position) {
                        case 0:
                                return new DetailFragment();
                        case 1:
                                return new ImageFragment(R.drawable.ic_launcher);
                        case 2:
                                return new ImageFragment(R.drawable.thumb);
                        default:
                                return null;
                        }
                }
        }
}
3.) Compile and build the project.
Output

Saturday 18 August 2012

How can I enable CD Burning in Windows Server 2003?


Windows Server 2003 has the CD burning drivers disabled by default. The IMAPI CD-Burning COM Service required by this peripheral device is disabled, so to make it work we need to enable it.
Note: With some third-party software, you may be able to burn CDs without starting the IMAPI CD-Burning COM Service. BTW, some people say that it is recommended you leave this service disabled if you want to speed up the Nero Burning ROM startup. I haven't tested this myself so I cannot say for sure.
Lamer Note: Yes, you DO have to have a CD burner installed or else this tweak will be useless for you. It DOES NOT turn a standard CD Drive into a CD-R or CD-RW...
To have CD burning capabilities on Windows Server 2003 follow the next steps:
  1. Go to the Services applet in Administrative Tools (or click Start, then Run, and type "services.msc" (without quotes) and click OK).
  2. Find the "IMAPI CD-burning COM" service, right-click and select Properties, select "Automatic" instead of "Disabled" in the startup type box.
  1. Click Apply.
  2. Right-click the "IMAPI CD-burning COM" service and select Start.
  1. Click OK.
You can also modify start state and start it from a Command Prompt console by using the following command:



Friday 17 August 2012

How can I disable the Welcome Screen in Windows XP Pro?

 To turn the Welcome Screen on or off:
You must have a computer administrator account on a computer that is a member of a workgroup or is a stand-alone computer to turn on or turn off the Use the Welcome screen feature. Logging on at the Welcome screen is not available on computers that are members of a network domain.

1. Open User Accounts in Control Panel.

2. Click Change the way users log on or off.

Do one of the following:
· To specify that users log on to the computer using the Welcome screen, select the Use the Welcome screen check box. A user logs on to the computer by clicking his or her user account name on the Welcome screen. If a password is assigned to the account, the user is prompted to type it.

· To specify that users log on to the computer without using the Welcome screen, clear the Use the Welcome screen check box. The Welcome screen will no longer appear when you start the computer. To log on to the computer, type your user name (and password, if you have one) in the standard Log On to Windows dialog box.

Note: To open User Accounts, click Start, click Control Panel, and then double-click User Accounts. Fast User Switching is available only when the Welcome screen is turned on.

Note: To disable the Welcome screen you can also open the Registry editor and go to

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\WinLogon

In the right pane, remove the entry for Gina.DLL.