STAR LINE TECHNOLAB

Complete Solution for every problem | Mobile Technology | Web Technology | Software | Mobile Apps | Scripts | Tricks | Latest Technology | Wordpress Plugins


Line Post

10 October, 2015

Recycler view and Card View in Andorid Development



Recyclerview is more advanced and flexible version of Listview added in Lollipop. It also Support in lower API of Android. This widget is a container for displaying large data sets that can be scrolled very efficiently by maintaining a limited number of views. Use the RecyclerView widget when you have data collections whose elements change at runtime based on user action or network events.

Application Development
Recycler view

The RecyclerView class simplifies the display and handling of large data sets by providing:
·         Layout managers for positioning items
·         Default animations for common item operations, such as removal or addition of items

To  add RecyclerView in your Project. you have to add Library of Recyclerview.

If you are using Android Studio and you are Supporting lower APIs,  You just need to add Gradle URL into your Module's Gradle file.

dependencies {

compile 'com.android.support:recyclerview-v7:23.0.1'

}

Once you sync  gradle lib from google will be downloaded into your project and you can use it.

Add RecyclerView into your activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<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"
   
tools:context=".MainActivity">

    <android.support.v7.widget.RecyclerView
       
android:id="@+id/recycler_view"
       
android:layout_width="match_parent"
       
android:layout_height="match_parent"
       
android:scrollbars="vertical" />
</LinearLayout>

Now you have added RecyclerView widget into your layout file, Obtain a handle to the object and connect it to layout manager and attach an adapter to show data.

public class MainActivity extends AppCompatActivity {



    ArrayList<String> arrayList = new ArrayList<>();



    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);



        for (int i = 0; i < 15; i++) {

            arrayList.add(String.valueOf(i));

        }



        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);



        /**

         *To Show RecyclerView as a List of data, LayoutManager is important to set.

         *  For ListView : LinearLayoutManager is used.

         *  For GridView : GridLayoutManager is used.

         *  For Staggered GridView: StaggeredGridLayoutManager is used

         */

        LinearLayoutManager manager = new LinearLayoutManager(MainActivity.this);

        recyclerView.setLayoutManager(manager);



        MyRecyclerViewAdapter myRecyclerViewAdapter = new MyRecyclerViewAdapter(MainActivity.this, arrayList);

        recyclerView.setAdapter(myRecyclerViewAdapter);

    }



    @Override

    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.

        getMenuInflater().inflate(R.menu.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.

        int id = item.getItemId();



        //noinspection SimplifiableIfStatement

        if (id == R.id.action_settings) {

            return true;

        }



        return super.onOptionsItemSelected(item);

    }

}

RecyclerView Adpter :

public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.ViewHolder> {



    Context context;

    ArrayList<String> strings;



    /**

     * public Constructor

     */

    public MyRecyclerViewAdapter(Context context, ArrayList<String> arrayList) {



        this.context = context;

        this.strings = arrayList;

    }



    @Override

    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_layout, parent, false);

        return new ViewHolder(view);

    }



    @Override

    public void onBindViewHolder(ViewHolder holder, int position) {



        holder.textView.setTag(position);

        holder.cardView.setTag(position);



        holder.textView.setText(strings.get(position));



        if (position % 2 == 0) {

            holder.cardView.setBackgroundColor(context.getResources().getColor(R.color.colorzero, null));

        } else {

            holder.cardView.setBackgroundColor(context.getResources().getColor(R.color.colorone, null));

        }



    }



    @Override

    public int getItemCount() {

        return strings.size();

    }



    public class ViewHolder extends RecyclerView.ViewHolder {



        TextView textView;

        CardView cardView;



        public ViewHolder(View itemView) {

            super(itemView);

            textView = (TextView) itemView.findViewById(R.id.textview);

            cardView = (CardView) itemView.findViewById(R.id.card_view);

        }

    }

}

CardView :

CardView is a extension of FrameLayout which lets you show data into card. It can have Shadows and Corners.

To show shadow use "cardElevation" attribute. In lollipop devices cardview uses real elevation and dynamic shadows.

Use these properties to customize the appearance of the CardView widget:

·         To set the corner radius in your layouts, use the card_view:cardCornerRadius attribute.
·         To set the corner radius in your code, use the CardView.setRadius method.
·         To set the background color of a card, use the card_view:cardBackgroundColor attribute.  

If you are using Android Studio and you are Supporting lower APIs,  You just need to add Gradle URL into your Module's Gradle file.

dependencies { compile 'com.android.support:cardview-v7:23.0.1'}





<?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:gravity="center"

    android:orientation="vertical">



    <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"

        android:id="@+id/card_view"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:layout_gravity="center_vertical"

        android:layout_margin="10dp"

        android:foregroundGravity="center"

        android:minHeight="50dp"

        card_view:cardCornerRadius="4dp"

        card_view:cardElevation="3dp">



        <TextView

            android:id="@+id/textview"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:layout_gravity="center_vertical"

            android:text="TextView"

            android:textColor="#000"

            android:textSize="25sp" />

    </android.support.v7.widget.CardView>

</LinearLayout>


To Check Full code please Go to Below Link.
Read more ...

13 December, 2014

WebRTC, a free browser-based technology, next step in digital communication

 WebRTC, a free browser-based technology, looks set to change the way we communicate and collaborate, up-ending telecoms firms, online chat services like Skype and WhatsApp and remote conferencing on WebEx.

WebRTC


What is WebRTC ?


WebRTC is a free, open project that enables web browsers with Real-Time Communications (RTC) capabilities via simple JavaScript APIs. The WebRTC components have been optimized to best serve this purpose. 

They build for To enable rich, high quality, RTC applications to be developed in the browser via simple JavaScript APIs and HTML5.

The WebRTC initiative is a project supported by Google, Mozilla and Opera. This page is maintained by the Google Chrome team.


WebRTC Diagram


The WebRTC standard solves a very common problem: incompatibilities for real-time communications. 

Today, to place audio or video calls from a computer, users need to download proprietary software and create accounts. 

WebRTC leverages the recent trend in which the web browser IS the “application”, and facilitates browser-to-browser communication, with no software downloads or registration needed. The browsers themselves include all the capabilities needed to support the standard. 

WebRTC standardizes communications between browsers, enabling audio and video communications, and data bridges to support text chat or file-sharing. 


They are building real dream to realistic communications standards over the web. The new web communication on the way to provide best and easy solution





Read more ...

12 December, 2014

Xiaomi phone banned in india

Recently shocking news for MI smartphone lovers
Actually Erection filed complaint against xiaomi and delhi high court banned till February 2015

Mr. Hugo barra founder of Xiaomi shared letter to indian fans

** A Letter to Indian Mi Fans **
Dear Mi fans,
We have been committed to continue our sales of Redmi Note and Redmi 1S devices in India. In the last 2 days alone, we received about 150,000 registrations for Redmi Note on Flipkart and the momentum has been terrific.
However, we have been forced to suspend sales in India until further notice due to an order passed by the Delhi High Court. As a law abiding company, we are investigating the matter carefully and assessing our legal options.
Our sincere apologies to all Indian Mi fans! Please rest assured that we’re doing all we can to revert the situation. We have greatly enjoyed our journey with you in India over the last 5 months and we firmly intend to continue it!
Stay tuned for more information.
Hugo
(on behalf of the Mi India team)

Read more ...

25 November, 2014

Xiaomi has revealed its first 4G smartphone in India


Cheapest 4G Smartphone in india

Chinese smartphone maker Xiaomi on Monday launched the much-anticipated Redmi Note 3G and 4G models, at Rs. 8,999 and Rs. 9,999 respectively. Pre-orders for the 3G Note is set to begin on November 25 at 6 p.m. through e-commerce retailer Flipkart while the 4G Note will be available across Airtel stores in six cities from the second half of next month.

Redmi Note 4G


Xiaomi Redmi Note will be available starting December 2 on Flipkart. Registration opens Nov 25 at 6pm.

Redmi note comes to India in 3G and 4G variants

The Xiaomi Redmi Note is powered by an octa-core Mediatek SoC clocked at 1.7GHz, mated to 2GB of RAM. 8GB storage .

5.5-inch 720p IPS screen on the Xiaomi Redmi Note, with Corning Gorilla Glass 3

Xiaomi’s Redmi Note sports a 13MP rear camera and a 5MP front facing camera.

The Xiaomi Redmi Note 4G is powered by a Snapdragon chip and is a single SIM device, unlike the 3G version. Comes with Swiftkey & Fleksy.

Cheapest 4G phone
Xiaomi Redmi Note 4G will also be sold by Airtel through its 100 flagship stores

Get your Redmi note register on flipkart.com
Read more ...

How to secure internet from hackers

Want FAST, SECURE and PRIVATE browsing....

Use this

"Disconnect.me"
It is browser extension helps users monitor and block more than 2,000 websites from collecting their data online.

Disconnect.me was founded by an ex-Googler to put users in control of their browsing history. disconnect me secure you from third party ads, other popup windows and much more 

Features :

  • Visualize Trackers 
  • Encrypted Internet
  • Safe Browsing 
  • Location Control
  • Anonymous Search

Secure your Internet from hackers  

 

Here is the link  : Click Here

Read more ...

24 November, 2014

How to format usb flash drive using MS-DOS

Hey Friends today i will teach how to format usb flash drive using MS-DOS. Many times we need to format our usb drives, people find it difficult so today reading this article you will be able to format you usb very easily,lets see the steps.

1) Click Start > Run... and type cmd in the box then Click OK

2) The command prompt window appears.

3) Type the following command:

format X:

Note: Replace "X:" with the letter of your USB Flash Drive.
You can use "diskpart" to list all drive letters.

4) If you want to format it as FAT32 then type:

format X: /FS:FAT32

5) After typing one of the above commands, press Enter

6) When it asks for pressing Enter again, just press it to confirm.

7) It will prompt you to enter a name for the drive, write it and hit Enter

So by reading this article i hope you will be now easily able to format your USB flash dirve.

Read more ...

22 November, 2014

All Microsoft Dos Commands to make your hacking easier


  • ADDUSERS Add or list users to/from a CSV file.
  • ARP Address Resolution Protocol.
  • ASSOC Change files extension associations.
  • ASSOCIAT One step files association.
  • AT Schedule a command to run at a later time.
  • ATTRIB Change file attributes.
  • BOOTCFG Edit Windows boot settings.
  • BROWSTAT Get domain, browser and PDC info.
  • CACLS Change files permissions.
  • CALL Call one batch program from another.
  • CD Change Directory - move to a specific Folder.
  • CHANGE Change Terminal Server Session properties.
  • CHKDSK Check Disk - check and repair disk problems
  • CHKNTFS Check the NTFS file system.
  • CHOICE Accept keyboard input to a batch file.
  • CIPHER Encrypt or Decrypt files/folders.
  • CleanMgr Automated cleanup of Temp files, recycle bin.
  • CLEARMEM Clear memory leaks.
  • CLIP Copy STDIN to the Windows clipboard.
  • CLS Clear the screen.
  • CLUSTER Windows Clustering.
  • CMD Start a new CMD shell.
  • COLOR Change colors of the CMD window.
  • COMP Compare the contents of two files or sets of files.
  • COMPACT Compress files or folders on an NTFS partition.
  • COMPRESS Compress individual files on an NTFS partition.
  • CON2PRT Connect or disconnect a Printer.
  • CONVERT Convert a FAT drive to NTFS.
  • COPY Copy one or more files to another location.
  • CSVDE Import or Export Active Directory data.
  • DATE Display or set the System date.
  • Dcomcnfg DCOM Configuration Utility.
  • DEFRAG Defrayment hard drive.
  • DEL Delete one or more files.
  • DELPROF Delete NT user profiles.
  • DELTREE Delete a folder and all subfolders.
  • DevCon Device Manager Command Line Utility.
  • DIR Display a list of Windows files and folders.
  • DIRUSE Display disk usage.
  • DISKCOMP Compare the contents of two floppy disks.
  • DISKCOPY Copy the contents of one floppy disk to another.
  • DNSSTAT DNS Statistics.
  • DOSKEY Edit command line, recall commands, and create macros.
  • DSADD Add user (computer, group..) to active directory.
  • DSQUERY List items in active directory.
  • DSMOD Modify user (computer, group..) in active directory.
  • ECHO Display message on screen.
  • ENDLOCAL End localization of environment changes in a batch file.
  • ERASE Delete one or more files.
  • EXIT Quit the CMD shell.
  • EXPAND Uncompress files.
  • EXTRACT Uncompress CAB files.
  • FC Compare two files.
  • FDISK Disk Format and partition.
  • FIND Search for a text string in a file.
  • FINDSTR Search for strings in files.
  • FOR Conditionally perform a command several times.
  • FORFILES Batch process multiple files.
  • FORMAT Format a disk.
  • FREEDISK Check free disk space (in bytes).
  • FSUTIL File and Volume utilities.
  • FTP File Transfer Protocol.
  • FTYPE Display or modify file types used in file extension associations.
  • GLOBAL Display membership of global groups.
  • GOTO Direct a batch program to jump to a labeled line.
  • HELP Online Help.
  • HFNETCHK Network Security Hot fix Checker.
  • IF Conditionally perform a command.
  • IFMEMBER Is the current user in an NT Workgroup.
  • IPCONFIG Configure IP.
  • KILL Remove a program from memory.
  • LABEL Edit a disk label.
  • LOCAL Display membership of local groups.
  • LOGEVENT Write text to the NT event viewer.
  • LOGOFF Log a user off.
  • LOGTIME Log the date and time in a file.
  • MAPISEND Send email from the command line.
  • MEM Display memory usage.
  • MD Create new folders.
  • MODE Configure a system device.
  • MORE Display output, one screen at a time.
  • MOUNTVOL Manage a volume mount point.
  • MOVE Move files from one folder to another.
  • MOVEUSER Move a user from one domain to another.
  • MSG Send a message.
  • MSIEXEC Microsoft Windows Installer.
  • MSINFO Windows NT diagnostics.
  • MSTSC Terminal Server Connection (Remote Desktop Protocol)
  • MUNGE Find and Replace text within file(s).
  • MV Copy in-use files.
  • NET Manage network resources.
  • NETDOM Domain Manager.
  • NETSH Configure network protocols.
  • NETSVC Command-line Service Controller.
  • NBTSTAT Display networking statistics (NetBIOS overTCP/IP).
  • NETSTAT Display networking statistics (TCP/IP).
  • NOW Display the current Date and Time.
  • NSLOOKUP Name server lookup.
  • NTBACKUP Backup folders to tape.
  • NTRIGHTS Edit user account rights.
  • PATH Display or set a search path for executable files.
  • PATHPING Trace route plus network latency and packet loss.
  • PAUSE Suspend processing of a batch file and display a message.
  • PERMS Show permissions for a user.
  • PERFMON Performance Monitor.
  • PING Test a network connection.
  • POPD Restore the previous value of the current directory saved by PUSHD.
  • PORTQRY Display the status of ports and services.
  • PRINT Print a text file.
  • PRNCNFG Display, configure or rename a printer.
  • PRNMNGR Add, delete, list printers set the default printer.
  • PROMPT Change the command prompt.
  • PsExec Execute process remotely.
  • PsFile Show files opened remotely.
  • PsGetSid Display the SID of a computer or a user.
  • PsInfo List information about a system.
  • PsKill Kill processes by name or process ID.
  • PsList List detailed information about processes.
  • PsLoggedOn Who's logged on (locally or via resource sharing)
  • PsLogList Event log records.
  • PsPasswd Change account password.
  • PsService View and control services.
  • PsShutdown Shutdown or reboot a computer.
  • PsSuspend Suspend processes.
  • PUSHD Save and then change the current directory.
  • QGREP Search file(s) for lines that match a given pattern.
  • RASDIAL Manage RAS connections.
  • RASPHONE Manage RAS connections.
  • RECOVER Recover a damaged file from a defective disk.
  • REG Read, Set or Delete registry keys and values.
  • REGEDIT Import or export registry settings.
  • REGSVR32 Register or unregistered a DLL.
  • REGINI Change Registry Permissions.
  • REM Record comments (remarks) in a batch file.
  • REN Rename a file or files.
  • REPLACE Replace or update one file with another.
  • RD Delete folder(s).
  • RDISK Create a Recovery Disk.
  • RMTSHARE Share a folder or a printer.
  • ROBOCOPY Robust File and Folder Copy.
  • ROUTE Manipulate network routing tables.
  • RUNAS Execute a program under a different user account.
  • RUNDLL32 Run a DLL command. (Add/remove print connections)
  • SC Service Control.
  • SCHTASKS Create or Edit Scheduled Tasks.
  • SCLIST Display NT Services.
  • ScriptIt Control GUI applications.
  • SET Display, set, or remove environment variables.
  • SETLOCAL Begin localization of environment changes in a batch file.
  • SETX Set environment variables permanently.
  • SHARE List or edit a file share or print share.
  • SHIFT Shift the position of replaceable parameters in a batch file.
  • SHORTCUT Create a windows shortcut (.LNK file)
  • SHOWGRPS List the NT Workgroups a user has joined.
  • SHOWMBRS List the Users who are members of a Workgroup.
  • SHUTDOWN Shutdown the computer.
  • SLEEP Wait for x seconds.
  • SOON Schedule a command to run in the near future.
  • SORT Sort input.
  • START Start a separate window to run a specified program or command.
  • SU Switch User.
  • SUBINACL Edit file and folder Permissions, Ownership and Domain.
  • SUBST Associate a path with a drive letter.
  • SYSTEMINFO List system configuration.
  • TASKLIST List running applications and services.
  • TIME Display or set the system time.
  • TIMEOUT Delay processing of a batch file.
  • TITLE Set the window title for a CMD.EXE session.
  • TOUCH Change files timestamps.
  • TRACERT Trace route to a remote host.
  • TREE Graphical display of folder structure.
  • TYPE Display the contents of a text file.
  • USRSTAT List domain usernames and last login.
  • VER Display version information.
  • VERIFY Verify that files have been saved.
  • VOL Display a disk label.
  • WHERE Locate and display files in a directory tree.
  • WHOAMI Output the current User Name and domain.
  • WINDIFF Compare the contents of two files or sets of files.
  • WINMSD Windows system diagnostics.
  • WINMSDP Windows system diagnostics II.
  • WMIC WMI Windows Commands.
  • XCACLS Change files permissions.
  • XCOPY Copy files and folders.


Note: All DOS Commands is not case sensitive but it's written in total uppercase or
lowercase. i.e. C:\ VER or C:\ ver & press Enter to see the output on the screen.
Happy Hacking!!!
Read more ...

Comments

Designed By