Subscribe via email

Enter your email address and get Latest Material :

Tag

%temp% Android Application to understand Activity Android Applicaton login button should remain disabled Android Program C Language GTU MCA Syllabus PPT/Notes C full ppt by keval nagaria C++ GTU MCA CPI/CGPA To Percentage Calculator Core JAVA GTU MCA Core Java Create Bootable USB flash Drive Using DISKPART utility Create USB Pen Drive Create an application that will create database with table of User credential. Create an application that will have spinner with list of animation names. On selecting animation name Create an application to call specific entered number by user in the EditText Create an application to make Insert Crimping DBMS GTU MCA Syllabus PPT/Note DISKPART DOS Command to Erase temp file DS GTU MCA Delete and retrieve operation on the database. Erase/Delete Temp file Ethernet FON GTU MCA FON Practical Solution FON Program Fundamental Of Networking GTU MCA PPT GTU Student FInd CPI/CGPA To Percentage Converter Intent Java Chapter Wise Slide Show For GTU MCA Student Sem-3 LAN Cable Online CPI/CGPA Converter/Calculator PL_SQL GTU MCA Syllabus PPT/Note RG45 Connector Read messages from the mobile and display it on the screen. SS(System Software) GTU MCA Understand Menu option. a. Create an application that will change color of the screen Understand resource folders : a. Create spinner with strings taken from resource folder b. On changing spinner value WTAD GTU MCA WTAD Practical Solution Web Technology And Application Development (WTAD) Windwos 7 USB Pen Drive application that will play a media file from the memory car application to send message between two emulators based on selected options from the menu. change image. delete temp file into C drive draw line on the screen as user drag his finger gtu mca android program open any URL inside the application and clicking on any link from that URl should not open Native browser but that URL should open the same screen. read file from asset folder and copy it in memory card. take picture using native application that animation should affect on the images displayed below. to pick up any image from the native application gallery and display it on the screen. update

Exercise : 11
Understanding of UI :

a. Create an UI such that , one screen have list of all the types of cars.
b. On selecting of any car name, next screen should show Car details like : name , launched date ,company name, images(using gallery) if available, show different colors in which it is available.
Screen Shot:


XML :
main.xml :

    

main1.xml :


   
  
  	
  	
  	
  	
  	
  	
  	
  

JAVA :
ElevenActivity.java :
package kmn.Eleven;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class ElevenActivity extends Activity implements OnItemClickListener
{
    /** @author Y@@D */
    ListView lv;
	@Override
    public void onCreate(Bundle savedInstanceState) 
	{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        lv=(ListView) findViewById(R.id.lv);
        lv.setClickable(true);
        lv.setOnItemClickListener(this);
    }

	public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) 
	{	
		try
		{
			Integer itn=Integer.valueOf(arg2);
			String ext=itn.toString();
			Intent i = new Intent(this,CarInfo.class);
			i.putExtra("CarPos", ext);
			startActivity(i);
		}
		catch(Exception e)
		{
			Toast.makeText(this, e.getMessage()+"    OnItemClick", Toast.LENGTH_LONG).show();
		}
	}
}
CarInfo.java :
package kmn.Eleven;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.TextView;

public class CarInfo extends Activity 
{
	/** @author Y@@D */
	TextView tv;
	private Gallery gallery;
	@Override 
	public void onCreate(Bundle savedInstanceState) 
	 {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.main1);
	       
	        tv=(TextView) findViewById(R.id.tv);
	        Intent i=this.getIntent();
	        String str =i.getStringExtra("CarPos");	        
	        gallery = (Gallery) findViewById(R.id.examplegallery);
	        gallery.setAdapter(new AddImgAdp(this,str));
	        if(str.equals("0"))
	        {
	        	tv.setText("Name:Maruti Suzuki 800"+"\n"+"Launched Date:1/3/1987"+"\n"+"Company Name:Maruti Suzuki"+"\nColors Available:\nWhite\nBlue\nRed\nLight Yellow");
	        }
	        else if(str.equals("1"))
	        {
	        	tv.setText("Name:Hyundai Accent Executive"+"\n"+"Launched Date:15/10/2010"+"\n"+"Company Name:Hyundai"+"\nColors Available:\nGray\nOcean Blue\nMidnight Black\nMaganta Blue");
	        }
	        else if(str.equals("2"))
	        {
	        	tv.setText("Name:Chevrolet Beat"+"\n"+"Launched Date:11/11/2011"+"\n"+"Company Name:Chevrolet"+"\nColors Available:\nMidnight Black\nAmazon Green\nRoyal Gold\nSport Red");
	        }
	        else
	        {	        	
	        	tv.setText("No car available");
	        }	        
	 }
}
class AddImgAdp extends BaseAdapter
{
	int GalItemBg;
	private Context cont;
	String positionLast;
	private Integer[] Imgidb = {R.drawable.b1, R.drawable.b2, R.drawable.b3, R.drawable.b4};
	private Integer[] Imgidh = {R.drawable.h1, R.drawable.h2, R.drawable.h3, R.drawable.h4};
	private Integer[] Imgidm = {R.drawable.m1, R.drawable.m2, R.drawable.m3, R.drawable.m4};

	public AddImgAdp(Context c,String pos) 
	{
	cont = c;	
	positionLast=pos;
	TypedArray typArray = c.obtainStyledAttributes(R.styleable.GalleryTheme);
	GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0);
	
	typArray.recycle();
	}

	public int getCount()
	{
	if(positionLast.equals("0"))
	{
		return Imgidm.length;
	}
	else if(positionLast.equals("1"))
	{
		return Imgidh.length;
	}
	else if(positionLast.equals("2"))
	{
		return Imgidb.length;
	}
	else
	{
		return Imgidm.length;
	}
	}

	public Object getItem(int position) {
	return position;
	}

	public long getItemId(int position) {
	return position;
	}

	public View getView(int position, View convertView, ViewGroup parent)
	{
	ImageView imgView = new ImageView(cont);
	if(positionLast.equals("0"))
	{
		imgView.setImageResource(Imgidm[position]);	
	}
	else if(positionLast.equals("1"))
	{
		imgView.setImageResource(Imgidh[position]);
	}
	else if(positionLast.equals("2"))
	{
		imgView.setImageResource(Imgidb[position]);
	}
	else
	{
		imgView.setImageResource(Imgidm[position]);
	}	
	// Fixing width & height for image to display
	imgView.setLayoutParams(new Gallery.LayoutParams(200, 200));
	imgView.setScaleType(ImageView.ScaleType.FIT_XY);
	imgView.setBackgroundResource(GalItemBg);
	return imgView;
	}
}

Related Posts Plugin for WordPress, Blogger...