1. What is findViewByld() Method used for?
- fiddViewByld() method used for finds a view that was identified by the id attribute from the XML that was processed in Activity.
2. What id R.Java?
- R.Java is used for is an auto-generated file by AAPT(Android Asset Packaging Tool) that contains resource IDs for all the resource of res/ directory.
3. What is AndroidManifest.xml?
- AndroidManifest.xml contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
4. What is Gradle?
- Android Studio projects utilize a build system called Gradle. The default setting may be sufficient, but we’ll take at build.gradle to see what is included and where changes might be neede.
5. How to set an event click on a button?
- Button: btn1; Btn1=(Button)findViewByld(R.id.btn1); Btn1.SetOnClickListener(this);
Public void on Click(View v);
Toast.makeText(this,”simpleclick”,Toast.LENGTH_SHORT).show();
6. Describe the step of adding a new Activity:
1/ right click on your project : Choose New => Activity =>Blank Activity
2/ option (don’t tick Lunhcer Activity)
3/ Auto Code in Android Manifest
7. What is Intent?
- Write some code. Intent in = new Intent (MainActivity.this,Main2Activity.class); StartActivity(in);
8. How to receive data from one Activity to another?
- In.putExtra() Method Ex: String u=getIntent().getExtras().getString() getInt() getDouble() getboolean()
9. Write some code to display a AlertDialong to display a title and a message?
AlertDialog.Builder msg=new Alert Dialog.Builder(this); Msg.setTitle(“My Title”), Msg.setMessage(“Are you ok?”) Msg.setIcon(android.R.drawable.ic.chat) Msg.setPositivebutton(“OK”,new Dialog.R.Interface.Onclick{ Public void onClick(…….){ Toast.makeTest(MainActivity.this,”ok”click, Toast(LENGTH_SHORT) Show(); } Msg.show();
10. Write some code to display a AlertDialog to disply a title, a message, and button.
AlertDialog.Builder alert=new AlertDialog.Builder(this); Alert.setMessage(“Are you want to Exit?”); Alert.setPositiveButton(“Exit”, new DialogInterface.OnClickListener(){ @Override Public void onClick(DialogInterface, int which){ MainActivity.this.finish(); } } ); Alert.setNagativeButton(“Stay”,null); Alert.show();
}
- fiddViewByld() method used for finds a view that was identified by the id attribute from the XML that was processed in Activity.
2. What id R.Java?
- R.Java is used for is an auto-generated file by AAPT(Android Asset Packaging Tool) that contains resource IDs for all the resource of res/ directory.
3. What is AndroidManifest.xml?
- AndroidManifest.xml contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
4. What is Gradle?
- Android Studio projects utilize a build system called Gradle. The default setting may be sufficient, but we’ll take at build.gradle to see what is included and where changes might be neede.
5. How to set an event click on a button?
- Button: btn1; Btn1=(Button)findViewByld(R.id.btn1); Btn1.SetOnClickListener(this);
Public void on Click(View v);
Toast.makeText(this,”simpleclick”,Toast.LENGTH_SHORT).show();
6. Describe the step of adding a new Activity:
1/ right click on your project : Choose New => Activity =>Blank Activity
2/ option (don’t tick Lunhcer Activity)
3/ Auto Code in Android Manifest
7. What is Intent?
- Write some code. Intent in = new Intent (MainActivity.this,Main2Activity.class); StartActivity(in);
8. How to receive data from one Activity to another?
- In.putExtra() Method Ex: String u=getIntent().getExtras().getString() getInt() getDouble() getboolean()
9. Write some code to display a AlertDialong to display a title and a message?
AlertDialog.Builder msg=new Alert Dialog.Builder(this); Msg.setTitle(“My Title”), Msg.setMessage(“Are you ok?”) Msg.setIcon(android.R.drawable.ic.chat) Msg.setPositivebutton(“OK”,new Dialog.R.Interface.Onclick{ Public void onClick(…….){ Toast.makeTest(MainActivity.this,”ok”click, Toast(LENGTH_SHORT) Show(); } Msg.show();
10. Write some code to display a AlertDialog to disply a title, a message, and button.
AlertDialog.Builder alert=new AlertDialog.Builder(this); Alert.setMessage(“Are you want to Exit?”); Alert.setPositiveButton(“Exit”, new DialogInterface.OnClickListener(){ @Override Public void onClick(DialogInterface, int which){ MainActivity.this.finish(); } } ); Alert.setNagativeButton(“Stay”,null); Alert.show();
}
Comments
Post a Comment