Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
630 connectés 

  FORUM HardWare.fr
  Programmation
  Android

  Afficher heure en XML

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Afficher heure en XML

n°2375204
scotjh
Posté le 04-02-2021 à 19:12:36  profilanswer
 

Bonjour,
 
Je voudrais afficher l'heure dans une appli Android mais je n'ai accès uniquement aux fichiers XML est il possible de la faire afficher dans ce fichier par exemple ?
 
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_width="fill_parent" android:layout_height="@dimen/compactEtaBarHeight"
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
    <RelativeLayout android:id="@id/fullLayout" android:visibility="visible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:animateLayoutChanges="true" android:layoutDirection="ltr">
        <com.waze.sharedui.views.WazeTextView android:textStyle="bold" android:gravity="center" android:id="@id/lblArrivalTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_centerVertical="true" style="@style/compactEtaBarText" />
        <ImageView android:id="@id/imgEtaDetailsSeparatorLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10.0dip" android:layout_marginRight="10.0dip" android:src="@drawable/eta_compact_bar_separator_dot" android:layout_toLeftOf="@id/lblArrivalTime" android:layout_centerVertical="true" />
        <ImageView android:id="@id/imgEtaDetailsSeparatorRight" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10.0dip" android:layout_marginRight="10.0dip" android:src="@drawable/eta_compact_bar_separator_dot" android:layout_toRightOf="@id/lblArrivalTime" android:layout_centerVertical="true" />
        <com.waze.sharedui.views.WazeTextView android:id="@id/lblTimeToDestination" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/imgEtaDetailsSeparatorLeft" android:layout_centerVertical="true" style="@style/compactEtaBarText" />
        <com.waze.sharedui.views.WazeTextView android:id="@id/lblDistanceToDestination" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/imgEtaDetailsSeparatorRight" android:layout_centerVertical="true" style="@style/compactEtaBarText" />
    </RelativeLayout>
    <com.waze.sharedui.views.WazeTextView android:textStyle="bold" android:gravity="center" android:layout_gravity="center" android:id="@id/lblOfflineDistanceToDestination" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/compactEtaBarText" />
</FrameLayout>  

mood
Publicité
Posté le 04-02-2021 à 19:12:36  profilanswer
 

n°2375213
tamiya
Monde de merde
Posté le 04-02-2021 à 22:56:51  profilanswer
 

As-tu des notions de programmation ?

n°2375271
scotjh
Posté le 05-02-2021 à 13:32:10  profilanswer
 

Oui un peu bien que je ne connaisse pas ce langage .
En fait j'ai "dezipé" une .apk d'où je peux agir sur les fichiers XML puis recompiler et réinstaller l'application.
Est il donc possible en intercalant dans un fichier XML autre chose que prévu pour de lui faire afficher l'heure par exemple.  

n°2375367
tamiya
Monde de merde
Posté le 06-02-2021 à 18:02:38  profilanswer
 

Essaie de rajouter une simple TextView avec un texte fixe pour voir ce que ça donne :)

n°2375407
scotjh
Posté le 07-02-2021 à 17:32:54  profilanswer
 

ok j'ai compris c'est impossible !!!.
 
Du coup je vais essayer de faire ma propre apk mais si tu veux bien Tamiya je crois que j'aurais besoin de ton aide.

n°2375839
scotjh
Posté le 14-02-2021 à 15:16:40  profilanswer
 

ok j'ai suivi les cours java et android tout n'est pas claire mais j'avance un peu.
 
Voici ce que je veux faire, l'algorithme:
 
1) Vérifier si waze est ouvert:
       -oui regarder s'il est au 1er plan sinon le mettre.
       -non démarrer waze.
 
2) vérifier si waze est au 1er plan :
     -oui afficher heure en bas.
     -non afficher heure en haut.
 
3) répéter 2 après une pause de 5 secondes.
 
C'est pas un prog qui à l'air compliqué mais je coince sur le début pour démarrer waze.
 
voici mon code:
package com.lunch.lanceurwaze;
 
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
 
public class MainActivity extends AppCompatActivity {
    private TextView text = null;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        Intent i = getPackageManager().getLaunchIntentForPackage("com.waze" );
        if (i != null)
        {
            startActivity(i);
        }
 
    }
}
 
Et... pas d'erreur mais waze ne se lance pas... Une idée ?

n°2375856
scotjh
Posté le 14-02-2021 à 19:09:18  profilanswer
 

j'ai aussi testé ca sans plus de succès:
 
        Intent intent = new Intent (Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        intent.setComponent(new ComponentName("com.waze" ));


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Android

  Afficher heure en XML

 

Sujets relatifs
Comment afficher tous les éléments d'une drowndown list ? Map RER A, afficher informations au clic
Afficher un bouton "envoyer" après validation reCAPTCHAAjouter bouton Afficher Plus / Voir Plus Automatiquement
Afficher plusieurs webcams du monde entier sur un ecranComment afficher une image provenant d'un formulaire type "radio"
conversion requête sql XML -> JSONAfficher l'arborescence des dossiers
[Wordpress] Afficher un contenu différent suivant des adresses IPAfficher flux http dans page html
Plus de sujets relatifs à : Afficher heure en XML


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR