Main Activity
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity {
private int taux=2850;
private TextView tauxC;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
[Link](this);
setContentView([Link].activity_main);
tauxC=(TextView)findViewById([Link]);
/*
String st="";
Intent intent = getIntent();
if (intent != null) {
if ([Link]("taux")) {
st = [Link]("taux");
}
else{
st="2800";
}
[Link]([Link]("1 Dollars vaut %s Fc", st));
}
else{
st=[Link](taux);
[Link]([Link]("1 Dollars vaut %s Fc", st));
}
taux=[Link](st);
*/
String fileName="[Link]";
try {
//open the file and retrieve the inputStream
InputStream inputStream = openFileInput(fileName);
if (inputStream != null) {
// open a reader on the inputStream
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
// String to use to store read lines
String str;
StringBuilder buf = new StringBuilder();
// Read the file
while ((str = [Link]()) != null) {
[Link](str);
}
// Close the reader
[Link]();
// Close the inputStream
[Link]();
// Affect the text to the textView
str=[Link]();
[Link]([Link]("1 Dollars vaut %s Fc", str));
taux=[Link](str);
}
}
catch ([Link] e) {
[Link](this, "FileNotFoundException", Toast.LENGTH_LONG);
}
catch (IOException e) {
[Link](this, "FileNotFoundException", Toast.LENGTH_LONG);
}
[Link](this, "Menu de l'Application", Toast.LENGTH_LONG).show();
[Link](findViewById([Link]), (v, insets) -> {
Insets systemBars = [Link]([Link]());
[Link]([Link], [Link], [Link], [Link]);
return insets;
});
}
public void usd(View view){
Intent intent=new Intent(this, [Link]);
[Link]("taux", taux);
startActivity(intent);
finish();
}
public void parametres(View view){
Intent intent=new Intent(this, [Link]);
[Link]("taux", taux);
startActivity(intent);
finish();
}
MainActivity2
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity2 extends AppCompatActivity {
private EditText montant;
private TextView message;
private TextView tauxC;
private int tauxDeConv=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
[Link](this);
setContentView([Link].activity_main2);
tauxC=(TextView)findViewById([Link]);
Intent intent = getIntent();
if (intent != null) {
if ([Link]("taux")) {
tauxDeConv = [Link]("taux",0);
}
}
[Link]([Link]("1 Dollars vaut %d Fc", tauxDeConv));
montant=(EditText)findViewById([Link]);
message=(TextView)findViewById([Link]);
[Link](findViewById([Link]), (v, insets) -> {
Insets systemBars = [Link]([Link]());
[Link]([Link], [Link], [Link], [Link]);
return insets;
});
}
public void retour(View view){
Intent intent=new Intent(this, [Link]);
startActivity(intent);
finish();
}
public void convertir(View view){
int calculer=[Link]([Link]().toString());
calculer=calculer*tauxDeConv;
[Link]("Résultat : "+[Link](calculer));
}
}
MainActivity3
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity3 extends AppCompatActivity {
private int tauxx=2850;
private EditText montantp;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
[Link](this);
setContentView([Link].activity_main3);
montantp=(EditText)findViewById([Link]);
[Link](findViewById([Link]), (v, insets) -> {
Insets systemBars = [Link]([Link]());
[Link]([Link], [Link], [Link], [Link]);
return insets;
});
}
public void retoura(View view){
tauxx=[Link]([Link]().toString());
Intent intent=new Intent(this, [Link]);
String fileNameStr="[Link]";
String fileContentStr= [Link]().toString();
try{
FileOutputStream fos= openFileOutput(fileNameStr, Context.MODE_PRIVATE);
// Open the writer
OutputStreamWriter outputStreamWriter=new OutputStreamWriter(fos);
// Write
[Link](fileContentStr);
// Close streams
[Link]();
[Link]();
}
catch (FileNotFoundException e) {
[Link]();
}
catch (IOException e) {
[Link]();
}
[Link]("taux", [Link]().toString());
startActivity(intent);
finish();
}
public void retour(View view){
Intent intent=new Intent(this, [Link]);
startActivity(intent);
finish();
}
string
<resources>
<string name="app_name">Conversion Fc-USD</string>
<string name="titre">Conversion USD en Fc ou Fc en USD</string>
<string name="titre1">USD en Fc </string>
<string name="titre2">Fc en USD</string>
<string name="titre3">Paramètre</string>
<string name="titre21">Convertir USD en CDF</string>
<string name="titre22">Montant en Dollars:</string>
<string name="titre23">Nombre de 0 à 760 000 :</string>
<string name="titre24">Convertir</string>
<string name="titre25">Résultat : </string>
<string name="titre26">Retour</string>
<string name="resultat">1 Dollars vaut 2850 Fc</string>
<string name="titre31">Paramètres</string>
<string name="titre32">1 Dollars vaut :</string>
<string name="titre33">Enregistrer</string>
</resources>
color
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
xml1
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:textAlignment="center"
android:text="@string/titre"
android:textSize="40sp"
android:textColor="@color/black"
android:layout_marginBottom="2dp"
/>
<TextView
android:id="@+id/tauxC"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textAlignment="center"
android:text="@string/resultat"
android:textSize="20sp"
android:textColor="@color/black"
android:layout_marginBottom="2dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/jj"
android:orientation="vertical"
android:layout_margin="10dp"
android:padding="20dp"
>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_margin="30dp"
android:background="@color/black"
android:gravity="center"
android:onClick="usd"
android:text="@string/titre1"
android:textColor="@color/white"
android:textSize="30sp" />
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/titre2"
android:layout_margin="30dp"
android:textSize="30sp"
android:gravity="center"
android:background="@color/black"
android:textColor="@color/white"
/>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/titre3"
android:layout_margin="30dp"
android:textSize="30sp"
android:gravity="center"
android:background="@color/black"
android:textColor="@color/white"
android:onClick="parametres"
/>
</LinearLayout>
</LinearLayout>
xml2
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity2"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:textAlignment="center"
android:text="@string/titre21"
android:textSize="40sp"
android:textColor="@color/black"
android:layout_marginBottom="20dp"
/>
<TextView
android:id="@+id/tauxC"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textAlignment="center"
android:text="@string/resultat"
android:textSize="20sp"
android:textColor="@color/black"
android:layout_marginBottom="2dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black"
android:orientation="vertical"
android:layout_margin="10dp"
android:padding="20dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_margin="20dp"
android:background="@color/black"
android:gravity="center"
android:text="@string/titre22"
android:textColor="@color/white"
android:textSize="30sp" />
<EditText
android:id="@+id/montant"
android:layout_width="match_parent"
android:layout_height="60dp"
android:autofillHints="creditCardNumber"
android:hint="@string/titre23"
android:layout_margin="10dp"
android:textSize="30sp"
android:inputType="numberDecimal"
android:gravity="center"
android:background="@color/white"
android:textColor="@color/black"
/>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/titre24"
android:drawableStart="@drawable/baseline_attach_money_24"
android:drawableTint="@color/white"
android:layout_margin="30dp"
android:textSize="30sp"
android:onClick="convertir"
android:gravity="center"
android:background="@color/black"
android:textColor="@color/white"
android:autoLink="all"
/>
<TextView
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_margin="20dp"
android:background="@color/black"
android:gravity="center"
android:text="@string/titre25"
android:textColor="@color/white"
android:textSize="30sp" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/titre26"
android:layout_marginTop="20dp"
android:layout_margin="70dp"
android:onClick="retour"
android:textSize="30sp"
android:gravity="center"
android:background="@color/black"
android:textColor="@color/white"
/>
</LinearLayout>
xml3
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity2"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:textAlignment="center"
android:text="@string/titre31"
android:textSize="40sp"
android:textColor="@color/black"
android:layout_marginBottom="20dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black"
android:orientation="vertical"
android:layout_margin="10dp"
android:padding="20dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_margin="20dp"
android:background="@color/black"
android:gravity="center"
android:text="@string/titre32"
android:textColor="@color/white"
android:textSize="30sp" />
<EditText
android:id="@+id/montantp"
android:layout_width="match_parent"
android:layout_height="60dp"
android:autofillHints="creditCardNumber"
android:hint="@string/titre23"
android:layout_margin="10dp"
android:textSize="30sp"
android:inputType="numberDecimal"
android:gravity="center"
android:background="@color/white"
android:textColor="@color/black"
/>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/titre33"
android:drawableStart="@drawable/baseline_attach_money_24"
android:drawableTint="@color/white"
android:layout_margin="30dp"
android:textSize="30sp"
android:onClick="retoura"
android:gravity="center"
android:background="@color/black"
android:textColor="@color/white"
android:autoLink="all"
/>
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="@string/titre26"
android:layout_marginTop="20dp"
android:layout_margin="70dp"
android:onClick="retour"
android:textSize="30sp"
android:gravity="center"
android:background="@color/black"
android:textColor="@color/white"
/>
</LinearLayout>