Posts

Showing posts from October, 2014

Android Listview

Image
Make layout named activity_main.xml  in resource folder. <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">     <ListView         android:id="@+id/listView"         android:layout_width="match_parent"         android:layout_height="wrap_content" >     </ListView> </LinearLayout> Make layout for row controls in resource folder named row_list.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 Dashboard

Make layout file named  activity_admin_dash_board.xml  in  layout  folder resides in your project. <RelativeLayout 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:background="@drawable/img_border" >     <GridView         android:id="@+id/gridViewOfAdminDashBoard"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_margin="10dp"         android:horizontalSpacing="3dp"         android:numColumns="2"         android:verticalSpacing="3dp" >     </GridView> </RelativeLayout> Make row file named  row_admin_g...

Use Intent

public class FirstActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent miTOSecondActivity = new Intent(FirstActivity.this,SecondActivity.class); miTOSecondActivity.putExtra("v1", "one" ); startActivity(miTOSecondActivity); } } public class SecondActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent i = getIntent(); String s = i.getStringExtra("v1"); Toast.makeText(SecondActivity.thiss , s ,Toast.LENGTH_SHORT).show(); } }

Android Environment Setup

Image
This following steps will set your sdk to your eclipse.  --> after downloading open eclipse,  --> go to windows menu --> select preferences --> select Android tab --> click browse button and select path of sdk folder and click apply.   Following steps will set your emulator on your pc, which will act just like your android device. --> go to windows menu --> select Android Virtual Device Manager --> by default list will show nothing , you have to create new one. So click CREATE button , it will open one dialogue box fill name of device(which can be anything you want) --> choose your device (any) --> target your sdk version (e.g 4.1,4.2) --> select CPU as ARM --> click ok     It will show your AVD list which you have just created.  select your AVD and click START button, your avd will run in sometime, wait for that till it doesn't look like your android d...