.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

ListFragment with Support Library

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

Hi Guys!

Today I am going to share the code the ListFragment. ListFragment  class is available inside the the android support v4 library.
Fragment is a new concept which is introduced in Android 3.0 and its higher versions.
A fragment that displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item. 
ListFragment hosts a List View object that can be bound to different data sources, typically either an array or a Cursor holding query results.
For mode details, you can visit the android developer site for ListFragment.

 

activity_main.xml








FriendsList.java

package com.sunil.fragmentlistview;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Toast;

public class FriendsList extends ListFragment implements OnItemClickListener{

String[] myFrriends = new String[] {
"Sunil Gupta",
"Abhishek Tripathi",
"Awadhesh Diwakar",
"Amit Verma",
"Jitendra Singh",
"Ravi Jhansi",
"Ashish Jain",
"Sandeep Pal",
"Shishir Verma",
"Ravi BBD"
};

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ArrayAdapter adapter= new ArrayAdapter(inflater.getContext(), android.R.layout.simple_list_item_1, myFrriends);
setListAdapter(adapter);
return super.onCreateView(inflater, container, savedInstanceState);
}
// this code for item click of the list

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

getListView().setOnItemClickListener(this);
}

@Override
public void onItemClick(AdapterView adapter, View view, int position, long id) {

Toast.makeText(getActivity().getBaseContext(), "Item clicked: " + myFrriends[position], Toast.LENGTH_LONG).show();

}
}

MainActivity.java

package com.sunil.fragmentlistview;

import com.sunil.fragmentlistview.R;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.activity_main);
}
}


Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel ListFragment with Support Library, Diterbitkan oleh scodeaplikasi pada Senin, 15 Juli 2013. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to