|
You have already posted this in QA:
Creation of android application[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
And in the Mobile forum below.
|
|
|
|
|
Today I come to you with one question - I am currently creating an Android application that works with the firestore and implemented a class that checks the account type. Everything works fine, however I would now like to get the value of "typeOfAcc" from this class in a different class as it will be the path to my document in the database, however, there is one condition - the path must be downloaded only after the data is downloaded from the database and based on it it will be determined whether the account type should be changed to "Trainers". Anyone have any idea? All my attempts so far have ended with the second class just getting this string before changing its value, resulting in no access to data. Checking the logs, everything is fine, the value changes, but unfortunately after getting the value. Thanks in advance for your help!
```
public class UserValid
{
String typeOfAcc = "Podopieczni";
FirebaseFirestore fStore;
FirebaseAuth fAuth;
DocumentReference documentReference;
List itemList = new ArrayList<>();
String userID;
public UserValid()
{
Log.d("TAG", "Błąd, wybrano konstruktor bez argumentów");
}
public UserValid(FirebaseAuth fAuth, FirebaseFirestore fStore)
{
userID = fAuth.getCurrentUser().getUid();
this.fAuth = fAuth;
this.fStore = fStore;
documentReference = fStore.collection("Podopieczni").document(userID);
readData(new FirestoreCallback()
{
@Override
public void onCallback(List<String> list)
{
if(itemList.get(0) == null)
{
typeOfAcc="Trenerzy";
Log.d("TAG", itemList.toString());
}
}
});
}
private void readData(FirestoreCallback firestoreCallback)
{
documentReference.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful())
{
String itemName = task.getResult().getString("Imie");
itemList.add(itemName);
firestoreCallback.onCallback(itemList);
}
}
});
}
private interface FirestoreCallback
{
void onCallback(List<String> list);
}
}
```
|
|
|
|
|
Member 15037009 wrote: ...I would now like to get the value of "typeOfAcc" from this class in a different class... If it's a peer class, can you store it in a preference? The "receiving" class can monitor any changes to the preference and only do something when it changes.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
<string>[{"UserId":"1","Usercode":"ADMIN","Password":"123"},
{"UserId":"2","Usercode":"Ravi","Password":"ravi"}]</string>
I have one question if I want to login with both user code and password which logic I should apply.
|
|
|
|
|
It depends what site/system you are logging in to. And in either case you should never store userids and passwords in clear text like that.
|
|
|
|
|
For a start UserID will not be available to the user so should be eliminated from that data set.
First check the user code exists, then check that the HASHED password matches the HASHED password stored in your database for that user code.
There are a number of articles on CP showing how to do password security properly.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
HI I'm new in android and I don't know how to call .NET webservice using android application I have task to login functionality at the time of the login in android application the username and password fetch from .NET webservice if they both are right then going on dashboard else showing appropriate message to the user. I hope anyone help me with solution and source code thank you
|
|
|
|
|
|
I will see whole sites but cant getting perfect solution of my problem
|
|
|
|
|
Why are you assuming that someone, somewhere has written the exact code you need to do exactly what you want and published it to the web?
Development is not about copy'n'paste code to solve every problem: someone has to write it to start with and to a greater or smaller part that will always be you! Library code is handy to help you do that, but it isn't going to do exactly what you want and will require changes and support code to get it to help you.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi
I am new to this area, I know that the RF Scanner Device is able to communicate with Warehouse Management System via connected wireless network.
Just to ask, is there any development guide line on this, such as:-
1. How RF Device Scan after, then transmit data to Warehouse Management System?
Hi, I would feel glad to be a membership of CodeProject, I know the site could help developer much
|
|
|
|
|
Check the Zebra website. they have API's and training for this sort of thing.
Intermec and Denso Wave have lots of resources.
Most apps seem to talk to a database at the backend. and are web app based. so as long as it fits the customers needs then i guess it would be ok.
|
|
|
|
|
Android studio. The program includes the ListView component. The ListView Item is populated via adapter from strings.xml. Each Item contains several words and one of them is a phone number. There is no problem filling in the Item. Need to do this when click (onclick) on a separate Item, program need to dial the number (call) that is specified inside the Item. How this can be done. Thanks.
|
|
|
|
|
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Hello everyone,
First I'm new here once again hello all.
Actually my question is very simple and I'm new in android,
How to put loading message (whether text or progress bar) after user click on new activity,
I have 2 activity both are: MainActivity and DashboardActivity
Here's MainActivity code :
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.textViewTest).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
startActivity(new Intent(MainActivity.this, DashboardActivity.class));
}
});
}
}
DashboardActivity
public class DashboardActivity extends AppCompatActivity
{
private Toolbar mTopToolbar;
private AppBarConfiguration mAppBarConfiguration;
private NavigationView navigationView;
private int progressStatus = 0;
private Handler handler = new Handler();
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
navigationView = findViewById(R.id.nav_view);
View hview = navigationView.getHeaderView(0);
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow)
.setOpenableLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
}
When I open dashboard activity it's show blank page approximately 4 - 5 sec before content loaded completely.
Q : My expectation is how to display loading text or progressbar when Dashboard activity blank / still loading?
please help
Thanks
|
|
|
|
|
Are you saying that it takes 4-5 seconds to go from one activity to another within the same app?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
David Crow wrote: Are you saying that it takes 4-5 seconds to go from one activity to another within the same app?
Yes, it because I used asynctask and cause frameskipping.
But thanks for reply
|
|
|
|
|
GongTji wrote: ...because I used asynctask...
Which is not shown in the code you provided.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How does one hire an app programmer for an app that relies on ones location and the world map? Would it cost a lot? I am not interested in making money with the app. I just want to create an interesting interface.
modified 13-Nov-20 21:01pm.
|
|
|
|
|
Try Freelancer[^] - but be aware: you get what you pay for. Pay peanuts, get monkeys.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Where does one even look for a good legit honest programmer? I don't know how to search.
modified 13-Nov-20 21:01pm.
|
|
|
|
|
Go to a local recruitment agency. It is really not that difficult.
|
|
|
|
|
I don't know what that is? What if the best person for the job isn't local?
modified 13-Nov-20 21:01pm.
|
|
|
|