I have a listview, but when I try to change the text color and size of the textview in the listview, it doesn't change, but I don't get an error. I used to get errors when I tried something but now I don't .I do not know how to do it. Here is the image showing the listview enter image description here
Java:
public class MainActivity extends AppCompatActivity {
DatabaseReference databaseReference;
List<pdfClass> uploads;
ListView listview;
FloatingActionButton floatingActionButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listview = findViewById(R.id.listview);
floatingActionButton = findViewById(R.id.floatingActionButton);
uploads = new ArrayList<>();
viewAllFiles();
listview.setOnItemClickListener((parent, view, position, id) -> {
pdfClass pdfupload = uploads.get(position);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType("application/pdf");
intent.setData(Uri.parse(pdfupload.getUrl()));
startActivity(intent);
});
floatingActionButton.setOnClickListener(view->{
Intent intent = new Intent(getApplicationContext(),UploadPDF.class);
startActivity(intent);
});
}
private void viewAllFiles() {
databaseReference = FirebaseDatabase.getInstance().getReference("Uploads");
databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot postsnapshot : snapshot.getChildren()){
pdfClass pdfClass = postsnapshot.getValue(furkan.demirel.myapplication.pdfClass.class);
uploads.add(pdfClass);
}
String[] Uploads = new String[uploads.size()];
for (int i =0;i<Uploads.length;i++){
Uploads[i]=uploads.get(i).getName();
}
ArrayAdapter<String> adapter= new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1,Uploads){
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent){
View view = super.getView(position,convertView,parent);
TextView text =(TextView) view.findViewById(android.R.id.text1);
text.setTextColor(Color.BLACK);
text.setTextSize(22);
return view;
}
};
listview.setAdapter(adapter);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
}