<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#724646" android:state_checked="true"/>
<item android:color="#724646" android:state_pressed="true"/>
<item android:color="#724646"/>
</selector>
app:itemIconTint="?navigationViewItemIconColor"
app:itemTextColor="?navigationViewItemTextColor"
package com.example.user.dbv2;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.GenericTypeIndicator;
import com.google.firebase.database.ValueEventListener;
import java.util.List;
public class Menu_item1 extends Fragment{
private FirebaseAuth mAuth;
private DatabaseReference myRef;
private List<String> drive;
ListView ListUserDrive;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Menu2");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_item1, container, false);
ListUserDrive = (ListView) v.findViewById(R.id.discr_for_tasks);
return v;
myRef = FirebaseDatabase.getInstance().getReference();
FirebaseUser user = mAuth.getInstance().getCurrentUser();
myRef.child(user.getUid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
GenericTypeIndicator<List<String>> t = new GenericTypeIndicator<List<String>>() {
};
drive = dataSnapshot.child("Вождение").getValue(t);
updateUI();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void updateUI() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, drive);
ListUserDrive.setAdapter(adapter);
}
}
}
package com.example.user.dbv2;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.GenericTypeIndicator;
import com.google.firebase.database.ValueEventListener;
import java.util.List;
public class Menu_item1 extends Fragment{
private FirebaseAuth mAuth;
private DatabaseReference myRef;
private List<String> drive;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Menu2");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_item1, container, false);
ListView ListUserDrive = (ListView) v.findViewById(R.id.discr_for_tasks);
return v;
myRef = FirebaseDatabase.getInstance().getReference();
FirebaseUser user = mAuth.getInstance().getCurrentUser();
myRef.child(user.getUid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
GenericTypeIndicator<List<String>> t = new GenericTypeIndicator<List<String>>() {
};
drive = dataSnapshot.child("Вождение").getValue(t);
updateUI();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
private void updateUI() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1, drive);
ListUserDrive.setAdapter(adapter);
}
}
}
package com.example.user.dbv2.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.example.user.dbv2.R;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.GenericTypeIndicator;
import com.google.firebase.database.ValueEventListener;
import java.util.List;
public class Menu_item1 extends Fragment {
private FirebaseAuth mAuth;
private DatabaseReference myRef;
private List<String> drive;
private List<String> drive2;
private List<String> teor;
private List<String> teor2;
ListView ListUserDrive;
ListView ListUserDrive2;
ListView ListUserTeor;
ListView ListUserTeor2;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Menu1");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_item1, container, false);
ListUserDrive = (ListView) findViewById(R.id.discr_for_tasks);
ListUserDrive2 = (ListView) findViewById(R.id.discr_for_tasks_test);
ListUserTeor = (ListView) findViewById(R.id.teor);
ListUserTeor2 = (ListView) findViewById(R.id.teor2);
myRef = FirebaseDatabase.getInstance().getReference();
FirebaseUser user = mAuth.getInstance().getCurrentUser();
myRef.child(user.getUid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
GenericTypeIndicator<List<String>> t = new GenericTypeIndicator<List<String>>() {
};
GenericTypeIndicator<List<String>> t2 = new GenericTypeIndicator<List<String>>() {
};
GenericTypeIndicator<List<String>> t3 = new GenericTypeIndicator<List<String>>() {
};
GenericTypeIndicator<List<String>> t4 = new GenericTypeIndicator<List<String>>() {
};
drive = dataSnapshot.child("Вождение").getValue(t);
drive2 = dataSnapshot.child("Вождение_Когда").getValue(t2);
teor = dataSnapshot.child("Теория").getValue(t3);
teor2 = dataSnapshot.child("Теория_Когда").getValue(t4);
updateUI();
updateUI2();
updateUI3();
updateUI4();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void updateUI() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1, drive);
ListUserDrive.setAdapter(adapter);
}
private void updateUI2() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1, drive2);
ListUserDrive2.setAdapter(adapter);
}
private void updateUI3() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1, teor);
ListUserTeor.setAdapter(adapter);
}
private void updateUI4() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1, teor2);
ListUserTeor2.setAdapter(adapter);
}
}
package com.example.user.dbv2.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.user.dbv2.R;
public class Menu_item1 extends Fragment {
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Menu1");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_item1, container, false);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>