Question 2 Here's some activity code from a separate project. When the user clicks on an item in a list view, the code is meant to display the text of that item in a text view (the text view has an ID of text_view and the list view has an ID of list_view). Does the code do what it's meant to? If not, why not? [5] package com.example.icetask2; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget. TextView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AdapterView.OnItemClickListener() { public void onItemClick (AdapterView<?> listView, View v, int position, long id) { TextView item= (TextView) v; textView.setText(item.getText()); }; ListView listView = (ListView) findViewById(R.id. List_view); TextView textView = findViewById(R.id.text_view); AdapterView.OnItemClickListener itemClickListener = new
Auto Save Option 1 OFF Fig 1.1 Create an android app as shown on the figure 1.1. The app should have the following components ImageButton ✓ Buttons (Open and a Save button) ✓ CheckBox ✓ ToggleButton Ý RadioButton ✓ RadioGroup Your app should be able to do the following: 1. When you click on the button SAVE your app should display a toast message, you have clicked SAVE button 2. When you click on the button OPEN button your app should display a toast message, you have clicked OPEN button. 3. When you click on the checkbox auto save your app should display a toast message, you have clicked on the Auto Save check box. 4. When you click on a radio button your app should display a toast message, you have clicked on Option1 or Option 2 depending on the button you clicked. Option 2
Question 2 Here's some activity code from a separate project. When the user clicks on an item in a list view, the code i
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am