
Concept explainers
the code have some error .its an android code .
android app with java
activity2 class
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class PlayerActivity2 extends AppCompatActivity {
ListView simpleList;
String SerialNo[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
int flags[] = {R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4, R.drawable.image5, R.drawable.image6, R.drawable.image7, R.drawable.image8, R.drawable.image9, R.drawable.image10};
String Names[] = {"mmm", "nnn", "aaa.", "bbb", "ccc", "ddd", "eee jk", " ijk", "Virgil jk", "gil jklk"};
String Score[] = {"1", "2", "3", "5", "4", "3", "5", "5", "5", "5"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity2);
simpleList = (ListView) findViewById(R.id.simpleListView);
CustomAdapter customAdapter = new CustomAdapter(getApplicationContext(), simpleList, SerialNo, flags, Names, Score);
simpleList.setAdapter(customAdapter);
simpleList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
if (imageView != null) {
saveImage(getApplicationContext(), ((BitmapDrawable) imageView.getDrawable()).getBitmap(), Names[position]);
}
}
});
}
public void saveImage(View view) {
CircleImageView imageView = (CircleImageView) view;
Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
String fileName = "image" + System.currentTimeMillis() + ".jpg";
File dir = getApplicationContext().getDir("images", Context.MODE_PRIVATE);
File file = new File(dir, fileName);
try {
FileOutputStream fos = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
Toast.makeText(getApplicationContext(), "Image saved", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
}
public void showToast(View view) {
Toast.makeText(getApplicationContext(), "Save Image button clicked", Toast.LENGTH_SHORT).show();
}
}
--------
the goal foe this code is , on these images and the images will be saved in the phone's internal storage.
Only clicking on the picture will save it, and clicking on the rest will not respond.
When you click Save Image, a tosat reminder that the image has been saved will appear.
Can save any picture.
when click the picture , the image should savey names, like click picture
image aaa , it should save name aaa.jpg

Step by stepSolved in 2 steps

- Write an android project that consist of the following: One activity (java file). Two different layouts (XML files). Each layout will have the following: Textview: contains the type of the layout you choose for this layout, for example, ConstraintLayout, table-layout, or LinearLayout (vertically or horizontally)…etc Textview: contains show your full name. Textview: to show your student ID. A button: upon clicking, the button should switch the layout of the activity. For example, the button in layout 1 should change the layout to layout 2, and the button in layout 2 should change the layout to layout 1. Use your own name and ID. The nams is " Alanood " and the ID " 190139479 " .arrow_forwardCreate a simple 6x6 android snakes and ladders game. Use gridview for layout. Use .java and .xml. for building game.arrow_forwarda code is like this package com.example.ett;import androidx.appcompat.app.AppCompatActivity;import android.view.LayoutInflater;import android.view.View;import java.lang.reflect.Field;import androidx.recyclerview.widget.LinearLayoutManager;import androidx.recyclerview.widget.OrientationHelper;import androidx.recyclerview.widget.RecyclerView;import androidx.recyclerview.widget.StaggeredGridLayoutManager;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.TextView;import android.os.Bundle;import.NonNull;import java.util.ArrayList;import java.util.List;public class UniversityAdapter extends RecyclerView.Adapter<UniversityAdapter.ViewHolder> {private List<University> universities;public UniversityAdapter(List<University> universities) {this.universities = universities;}@NonNull@Overridepublic ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {View view =…arrow_forward
- Que 18. Design a layout in Android Studio IDE with given attributes: LinearLayout (gravity3Dcenter, orientation=vertical) TextView (text3DForm, textsize=50) TextView (text=Name) EditText (inputype=textPersonName, ems=10) TextView (text3DPassword) EditText (inputype3DtextPassword, ems=10) TextView (text=Email) EditText (inputype3DtextEmailAddress, ems=10) Button (text=sibmit)arrow_forwardWill 4 live is a mobile application that is being developed by a group of students for the purpose of donating money to charity. As part of the user interface design of this application, we are required to conduct user testing (prototype), thus we ask that you participate in user testing. only testing with actual users.arrow_forwardI WANT TO CONVERT THIS JETPACK CODE INTO SWIFT UI package com.example.tastemade import androidx.compose.foundation.Imageimport androidx.compose.foundation.layout.*import androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsimport androidx.compose.material3.Buttonimport androidx.compose.material3.Cardimport androidx.compose.material3.ExperimentalMaterial3Apiimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.graphics.painter.Painterimport androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.res.painterResourceimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.tooling.preview.Preview-import androidx.compose.ui.unit.dpimport androidx.navigation.NavHostControllerimport androidx.navigation.NavTypeimport androidx.navigation.compose.NavHostimport…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





