|
|
Member 13196220 wrote: How to Develop Shopping cart in Android,With PHP MYSQL Database Connectivity... That's at least three separate items (that can come together to eventually make your desired app). Have you tried to get each one working independently of the other?
Member 13196220 wrote: I am Working On this Project Since last two weeks but nothing is fruitful. So which part is troubling you, specifically?
"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
|
|
|
|
|
Hi Sifu..
I need some advice to properly implement MVVM with what I'm trying to do.
1) I have a WebView control in a View because I need user to manually login to a website.
2) Once login, it will set a flag to indicate that user has logged in. It will then go to another link in the website and periodically read a html element value.
3) The values read will then be displayed in a table in another View.
4) In the scenario when the user is logged off from the website, it will show the website login page again. And then it will continue to Step 2 and Step 3.
5) The View that has the WebView control only need to be shown for the user to log in to the website. After logging in, the View can be hidden, and only showing the table which contains the values read, which are periodically updated.
I have few ideas on how to implement it but I am not sure if my idea is correct or not.
Idea 1:
Have 2 View/ViewModel pair. 1 View/ViewModel (VM1) to display out the readings read. Another View/ViewModel (VM2) which contains WebView control for the user to login. VM1 will periodically trigger VM2 (by using mediator pattern) to read from the website. As VW2 tries to read from the website, if the user is not logged in to the website, it will go to the log in page. Once the user has logged in, it will go to the webpage that contains the html element and read the value. It will stay in that webpage so that the next time VW1 triggers VM2 to read the value, it can readily do so without user intervention.
Eventhough user may close the VM2's View, the View is not really closed. It is just hidden and the program is still able to read from the webpage in the background.
Idea 2:
Have View/ViewModel (VM1) to display out the value in the table. VM1 calls a service that does the reading of webpage. The service has a WebView control. If the user is not logged in, the service will instantiate a View/ViewModel (VM2) and passing in the WebView control which the user can use to log in. Once the user has logged in, the WebView control is passed back to the service so that the service can continue to read the html element. The service then triggers the ViewModel (VM2) to close the View.
Please advice on what is the correct MVVM way to do what I'm trying to do.
Thanks.
modified 10-May-17 18:00pm.
|
|
|
|
|
JoJo82 wrote: Hi Sifus Who is Sifus, and why do you think he/she will see this message?
|
|
|
|
|
Hi Richard.. forgive me for the misunderstanding..
Sifus is referring to Teacher/Master in Chinese because I'm still learning and there are a lot of very experienced people in this forum.
Actually, it is Sifu.. I just use Sifus to make it plural..
|
|
|
|
|
I have created android application with navigation drawer and when I click item from navigation drawer old fragment is not replaced,I can still see the old fragment under the new fragment.How to fix this issue?
private void displaySelectedScreen(int id)
{
Fragment fragment = null;
switch (id)
{
case R.id.home:
fragment = new Main();
break;
case R.id.settings:
Intent intent = new Intent(this, Settings.class);
startActivity(intent);
break;
case R.id.about:
Intent intent1 = new Intent(this, About.class);
startActivity(intent1);
break;
case R.id.share:
try
{
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Audiophileradio");
String sAux = "\nLet me recommend you this application\n\n";
sAux = sAux + "https://play.google.com/store/apps/details?id=Orion.Soft \n\n";
i.putExtra(Intent.EXTRA_TEXT, sAux);
startActivity(Intent.createChooser(i, "choose one"));
}
catch(Exception e)
{
}
break;
case R.id.send:
fragment = new Feedback();
break;
}
if (fragment != null)
{
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.contentFrame, fragment).commit();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item)
{
int id = item.getItemId();
displaySelectedScreen(id);
return true;
}
content_main.xml
="1.0"="utf-8"
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="audiophileradio.example.com.audiophileradio.MainActivity"
tools:showIn="@layout/app_bar_main"
android:background="@drawable/backg1">
<FrameLayout
android:id="@+id/contentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</FrameLayout>
<TextView
android:id="@+id/textView3"
android:layout_width="13dp"
android:layout_height="21dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:text="+"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.977"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.13"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"/>
feedback.xml
="1.0"="utf-8"
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:text="Title :"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.103"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.081"/>
<EditText
android:id="@+id/editText"
android:layout_width="218dp"
android:layout_height="35dp"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.593"
app:layout_constraintVertical_bias="0.084"
android:background="@drawable/border"/>
</android.support.constraint.ConstraintLayout
|
|
|
|
|
See here.
"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
|
|
|
|
|
Hello everyone i need to hashed my password when i put it in my login application android and then i need to compare it with my password in my table fos_user of symfony and the password in fos_user is encoders:bcrypt
This is my code:
<?php
include 'config.inc.php';
if(isset($_POST['username']) && isset($_POST['password']))
{
$result='';
$username = $_POST['username'];
$password = $_POST['password'];
$hash = password_hash($password, PASSWORD_BCRYPT);
$sql = "SELECT password FROM fos_user WHERE username = '$username' AND password = '$hash'";
$test = mysql_query($sql) or die( mysql_error() );
$row = mysql_fetch_assoc($test);
if ($hash == $row['password'])
{
$result="true";
}
else
{
$result="false";
}
echo $result;
}
?>
My file config.inc.php is this code
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "projet_grh";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
die("OOPs something went wrong");
}
?>
|
|
|
|
|
What does this have to do with Android programming? More importantly, what is the problem?
|
|
|
|
|
i need to compare the password in my application Android in the login with my password in my database
|
|
|
|
|
So what is (not) working?
"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
|
|
|
|
|
i cant login when i grap my username and my password i thnik there are a problem in my code php but i don't find it
|
|
|
|
|
Member 13023118 wrote: ...i thnik there are a problem in my code php but i don't find it Perhaps you'd be better served here. Once your PHP code is returning the proper credentials, then you can come back to this forum and focus on your Android code.
"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
|
|
|
|
|
ok thank you very much
|
|
|
|
|
So where is this PHP code running, where is the database, and what application on the Android system is connected to it?
|
|
|
|
|
i have a file named test.rar which have password that i set on it ,cuz i have a database file in it ,
i want to open this file and read data from my database file and use it for my app in android studio .
how can i do it ?
|
|
|
|
|
What problem are you having (other than needing all of this code to exist)?
|
|
|
|
|
You already posted this question in QA - How to open a rar file with password[^]
I asked you some questions on that post.
Do not post the same question in multiple forums on this site - it's rude.
|
|
|
|
|
Store the .rar file in your project's assets folder. During runtime, you can access and save that file to the phone's internal storage or the SD card. As I understand it, RAR is a propriatary format so you can't unarchive it using Java's SDK. Use a third party library like junrar to do the unarchiving.
"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
modified 25-Apr-17 10:00am.
|
|
|
|
|
I am working with googlemap. I have implemented custom marker window, this window contains photo of the marker. I am taking the url of the photo as string and setting it into imageview with thread. However, the code is not syncronized with user. When I have clicked the marker, it shows the photo of the previeus marker that I have clicked. When I did debug, I can see that true url values are coming from background but the setting image into imageview operation is becoming late. How can I solve this problem? I have tried picasso and glide but still same problem.
@Override
public void onMapReady(GoogleMap map) {
this.infoWindow = (ViewGroup)getActivity().getLayoutInflater().inflate(R.layout.info_marker_window, null);
this.mekanfoto = (ImageView) infowindow.findViewById(R.id.mekan_foto);
googleMap = map;
if(googleMap!=null){
googleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(final Marker marker) {
if(mLastLocation.getLatitude()!=marker.getPosition().latitude||
mLastLocation.getLongitude()!=marker.getPosition().longitude){
customMarker = CustomMarker.getCustomMarker(listCustomMarker, marker);
final String URL = customMarker.getVenue().getFoto();
createThread(mekanfoto,URL).start();
mapWrapperLayout.setMarkerWithInfoWindow(marker, infoWindow);
return infoWindow;
}
return null;}
});
}
}
private synchronized Thread createThread(final ImageView imageView, final String URL)
{
final Bitmap[] b = new Bitmap[1];
Thread thread=new Thread(new Runnable() {
@Override
public void run() {
b[0] =download_Image(URL,imageView);
}
});
return thread;
}
public Bitmap download_Image(String url,ImageView imageview) {
URL newurl = null;
try {
newurl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
Bitmap mIcon_val = null;
try {
URLConnection urlConnection=newurl.openConnection();
InputStream is=urlConnection.getInputStream();
mIcon_val= BitmapFactory.decodeStream(is);
} catch (Exception e) {
e.printStackTrace();
}finally {
}
imageview.setImageBitmap(mIcon_val);
return mIcon_val;
}
modified 18-Apr-17 12:31pm.
|
|
|
|
|
Having the coordinates from Android Sensor and try to calculate the distance in Excel according to:
http://andrew.hedges.name/experiments/haversine/
dlon = lon2 - lon1
dlat = lat2 - lat1
a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2
c = 2 * atan2( sqrt(a), sqrt(1-a) )
d = R * c (where R is the radius of the Earth)
Enter my two Locations in the calculator (link above) shows me the right result, it is about 6m.
When I calculate it by Excel I get 20Km instead of 6 meters
I'm strongly assuming that I mix up rad vs. degree but I do not find where I'm wrong.
Excel trigonometric functions expect everything in rad so I adjust lon1, lon2, lat1, lat2 first into rad...
Where I could be wrong, any idea?
Thank you in advance.
N.B: I'm also not sure whether it is ok to use the sensor decimal values directly for trigonometric function, maybe this is the key Point.
[Edit]
c allways Shows me something very near PI, e.g. 3.14159145
modified 19-Jan-21 21:04pm.
|
|
|
|
|
0x01AA wrote: Where I could be wrong Just about anywhere. Does this have something to do with Android programming?
|
|
|
|
|
Yes it has and no. The Lib I'm using is Embarcardero Fire-ThisAndThat. Some of the Sensors are Android specific supported
So where you suggest to ask the question?
Sorry, but .... grrrr
AND PLEASE DO NOT MARK YOUR COMMENT AS ANSWER TO EARN POINTS!!
SILLY DOWNVOTER!
SORRY, BRUNO
modified 19-Jan-21 21:04pm.
|
|
|
|
|
0x01AA wrote: Having the coordinates from Android Sensor and try to calculate the distance in Excel according to: So where exactly is the Android code issue?
Sorry but ?
|
|
|
|
|
If you are not familar with it why you bother about it?
DOWNVOTE TWO TIMES, SORRY YOU ARE AN A*H*. Now please Report me as abuser!
modified 19-Jan-21 21:04pm.
|
|
|
|