Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. In the simple list: A.why it is necessary to use android:id attribute as @id/

ID: 3808610 • Letter: 2

Question

2.

In the simple list:

A.why it is necessary to use android:id attribute as @id/android:list rather than using @+id/

B.How this changes the way to grab the ListView widget in the relevant java class instead of using findViewById method?

Add a ListView with an android:id of @android:id/list to your layout, where you want the list to appear.

Or, delete your onCreateView() implementation, so you get the inherited ListView that you get from ListFragment.

Or, change your fragment to inherit from Fragment, not ListFragment and manage a ListView by yourself.

Or, change your fragment to inherit from Fragment and do not attempt to show a list in it.

3.Clarify the benefits of using DialogFragment subclass as an alternative of using dialog helper methods in the Activity class.

4.Clarify the differences between the types of location sensors built-in to the mobile device. And how the Location information is accessed within an app?

5.

Illustrate the concept of how sensors and managers used to access sensor data to create a compass that calculate the device heading.

package com.example.daycalculator;

import java.util.ArrayList;

import java.util.List;

import android.app.Activity;

import android.os.Bundle;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.ArrayAdapter;

import android.widget.Button;

import android.widget.Spinner;

import android.widget.Toast;

import android.widget.EditText;

public class MainActivity extends Activity {

private Spinner spinner1, spinner2;

private EditText EditText;

private Button btnSubmit;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

addItemsOnSpinner2();

addListenerOnButton();

addListenerOnSpinnerItemSelection();

}

// add items into spinner dynamically

public void addItemsOnSpinner2() {

spinner2 = (Spinner) findViewById(R.id.day);

List<String> list = new ArrayList<String>();

list.add("1"); list.add("2");list.add("3");list.add("4");list.add("5");list.add("6");list.add("7");

list.add("8");list.add("9");list.add("10");list.add("11");list.add("12");list.add("13");list.add("14");

list.add("15");list.add("16");list.add("17");list.add("18");list.add("19"); list.add("20");list.add("21");

list.add("22");list.add("23");list.add("24");list.add("25");list.add("26");list.add("27");

list.add("28");list.add("29");list.add("30");list.add("31");

ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,

android.R.layout.simple_spinner_item, list);

dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

spinner2.setAdapter(dataAdapter);

}

public void addListenerOnSpinnerItemSelection() {

spinner1 = (Spinner) findViewById(R.id.month);

spinner1.setOnItemSelectedListener(new CustomOnItemSelectedListener());

}

// get the selected dropdown list value

public void addListenerOnButton() {

spinner1 = (Spinner) findViewById(R.id.month);

spinner2 = (Spinner) findViewById(R.id.day);

setEditText((EditText) findViewById(R.id.year));

btnSubmit = (Button) findViewById(R.id.btnSubmit);

btnSubmit.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

Toast.makeText(MainActivity.this,

"OnClickListener : " +

" Spinner 1 : "+ String.valueOf(spinner1.getSelectedItem()) +

" Spinner 2 : "+ String.valueOf(spinner2.getSelectedItem()),

Toast.LENGTH_SHORT).show();

}

});

}

public EditText getEditText() {

return EditText;

}

public void setEditText(EditText editText) {

EditText = editText;

}

}

PLease write by computer and answer all question.. THANKS

Explanation / Answer

2.

In the simple list:

A. why it is necessary to use Android:id attribute as @id/android: list rather than using @+id/

=>when you’re using @id it means to your are referring an id which have be already shaped .so you need not generate some original id

=>except when you be using robot: id then you are specify a original id plus it will call the builder

To make new entrance called R.java so as to you contain to comprise assign .

B. How this changes the way to grab the List View widget in the relevant java class instead of using find View ById method?

=>we container employ the register view using <list view> </>

=>we can grab the identification by means of android: id’@+id/list view"

=>we can as well denote the plan Height, Gravity ,layout width.

=>this @view bide is parallel to the calling find view Bide ()

=>instance: @View bide (R.id. your Text view)

=>we can also employ the find viewed (R.id.Text1)

Generally we should expand the splinter additionally it will be unconditional through root scrutiny class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote