[Solved] Generate a RANDOM id for users [closed]

(You will want to take a look at the Random class in java. It provides random numbers, which is very useful. To answer your question, I would suggest having a String of allowed characters in the ID, and constructing a new string using a StringBuilder, by selecting random characters from your ALLOWED_CHARACTERS string. Something like … Read more

[Solved] i want to retrieve current logged user data from firestore but this show error [duplicate]

Change your onCreate method code to : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_account); email = (TextView)findViewById(R.id.email_txt); mAuth = FirebaseAuth.getInstance(); UserId = mAuth.getCurrentUser().getUid(); passwordtxt = (TextView)findViewById(R.id.pass_txt); mFirestore = FirebaseFirestore.getInstance(); mFirestore.collection(“Hospitals”).document(UserId).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() { @Override public void onSuccess(DocumentSnapshot documentSnapshot) { String user_name = documentSnapshot.getString(“email”); String password = documentSnapshot.getString(“password”); email.setText(user_name); passwordtxt.setText(password); } }); } 5 solved i want … Read more

[Solved] ListView returning null using Fragment

This is happening because you are using the wrong View variable to find the ListView. ListView lv = (ListView) view.findViewById(R.id.lvAlerts); The view variable here refers to: public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { You need to refer to this view: view = inflater.inflate(R.layout.tab_frag_alerts, container, false); You should change the declaration: View … Read more

[Solved] Java String comparison wrong outcome [closed]

You should write it like that, way easier to read : if (!Arrays.asList(ip, port, username, password).contains(newSet)) { saveButton.setEnabled(true); } else { saveButton.setEnabled(false); } Or : saveButton.setEnabled(!Arrays.asList(ip, port, username, password).contains(newSet)); 1 solved Java String comparison wrong outcome [closed]

[Solved] How divide space between Bottom Navigation View?

I need to create Bottom Navigation with two menu item. but the view ratio is 30:70 and text gravity is in centre. one menu contain image and text one is only text AFAIK you can not achieve using menu better to create custom layout for this Sample code <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:gravity=”center” android:layout_margin=”10dp” android:layout_alignParentBottom=”true” android:orientation=”horizontal” … Read more

[Solved] How to open new activity after clicking list view with search bar element?

You can search on a listview and you can use OnItemClickListener From search view new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { if (TextUtils.isEmpty(newText)) { mListView.clearTextFilter(); } else { mListView.setFilterText(newText.toString()); //you can use this to filter items } return true; } @Override public boolean onQueryTextSubmit(String query) { return true; } } And in Listview … Read more

[Solved] how to add search functionality in edittext in Android

Load all the contacts in array list or string array and then use AutoCompleteTextView for adding search functionallity Gett all contacts like this as expalined here public ArrayList<PhoneContactInfo> getAllPhoneContacts() { Log.d(“START”,”Getting all Contacts”); ArrayList<PhoneContactInfo> arrContacts = new ArrayList<PhoneContactInfo>(); PhoneContactInfo phoneContactInfo=null; Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; Cursor cursor = context.getContentResolver().query(uri, new String[] {ContactsContract.CommonDataKinds.Phone.NUMBER,ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,ContactsContract.CommonDataKinds.Phone._ID}, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + … Read more

[Solved] Calling a number in an array

you need to write service to check if current call is ended or not. after disconnection of one call you can dial next number from your array in onRecieve method of BroadcastReceiver. code to check call is disconnected or not. switch(state) { case TelephonyManager.CALL_STATE_IDLE: Log.d(“Call”,”Outgoing Call finished”); break; case TelephonyManager.CALL_STATE_OFFHOOK: Log.d(“Call”,”Outgoing Call Starting”); break; } … Read more

[Solved] clicking function in android [closed]

If you want to send something by email your best bet is to use ACTION_SEND. Then it can be picked-up by email app, Twitter app, Facebook app – depending on what apps user may have on his device private void sendBy(final String title, final String text) { Intent i = new Intent(android.content.Intent.ACTION_SEND); i.setType(“text/plain”); i.putExtra(Intent.EXTRA_SUBJECT, title); … Read more