J'ai crée une application qui fonctionne avec un code (html, javascript) sur android_asset, donc en cours d'exécution de l'application, il affiche la page Web.
dans cette etape y'a pas de problème parce que l'affichage fonctionne bien .

le principe de web site qui est intégré dans android_asset il télécharge le tableau qui existe sur un format excel .

cela fonctionne bien dans mon ordinateur, je veux dire quand j'ouvre le site Web dans le navigateur je peux télécharger la table.

Pièce jointe 364196

mais quand je l'exécute dans mon téléphone , même si je click sur le button il fonction pas , ca veut dire il lance pas le téléchargementl

voiala le code html
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
<html>
<head>
 
<title>Nouvelle Inscription</title>
 
<style>
{
	color:#2b2b2b;
	font-family: "Roboto condensed";
}
 
table{width:40%;}
th{ text-align:left;color:#4679bd}
tbody > tr:nth-of-type(even){ background-color:#daeaff;}
button{cursor:pointer;margin-top:1rem;}
 
</style>
 
<script>
function downloadCSV(csv, filename) {
    var csvFile;
    var downloadLink;
 
    // CSV file
    csvFile = new Blob([csv], {type: "text/csv"});
 
    // Download link
    downloadLink = document.createElement("a");
 
    // File name
    downloadLink.download = filename;
 
    // Create a link to the file
    downloadLink.href = window.URL.createObjectURL(csvFile);
 
    // Hide download link
    downloadLink.style.display = "none";
 
    // Add the link to DOM
    document.body.appendChild(downloadLink);
 
    // Click download link
    downloadLink.click();
}
 
function exportTableToCSV(filename) {
    var csv = [];
    var rows = document.querySelectorAll("table tr");
 
    for (var i = 0; i < rows.length; i++) {
        var row = [], cols = rows[i].querySelectorAll("td, th");
 
        for (var j = 0; j < cols.length; j++) 
            row.push(cols[j].innerText);
 
        csv.push(row.join(","));        
    }
 
    // Download CSV file
    downloadCSV(csv.join("\n"), filename);
}
 
 
</script>	
 
 
</head>
 
<body>
 
<table>
	<tr>
		<th>Name</th>
		<th>Email</th>
		<th>Country</th>
	</tr>
	<tr>
		<td>John Doe</td>
		<td>john@gmail.com</td>
		<td>USA</td>
	</tr>
	<tr>
		<td>Stephen Thomas</td>
		<td>stephen@gmail.com</td>
		<td>UK</td>
	</tr>
	<tr>
		<td>Nataly Oath</td>
		<td>natly@gmail.com</td>
		<td>France</td>
	</tr>
 
<button onclick="exportTableToCSV('members.csv')">Export HTML Table To CSV File</button>
 
</body>
 
</html>
voila le code de mainActivity

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
public class MainActivity extends AppCompatActivity {
 
    WebView webhtml;
 
    private static final String TAG = "MainActivity";
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        webhtml = (WebView) findViewById(R.id.webView);
 
        WebSettings ws = webhtml.getSettings();
        ws.setJavaScriptEnabled(true);
 
        webhtml.setWebViewClient(new WebViewClient()
        {
 
            @Override
            public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
            {
                handler.proceed();
            }
        });
 
        webhtml.loadUrl("file:///android_asset/index.html");
 
    }
 
    public  boolean isReadStoragePermissionGranted() {
        if (Build.VERSION.SDK_INT >= 23) {
            if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
                    == PackageManager.PERMISSION_GRANTED) {
                Log.v(TAG,"Permission is granted1");
                return true;
            } else {
 
                Log.v(TAG,"Permission is revoked1");
                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 3);
                return false;
            }
        }
        else { //permission is automatically granted on sdk<23 upon installation
            Log.v(TAG,"Permission is granted1");
            return true;
        }
    }
 
    public  boolean isWriteStoragePermissionGranted() {
        if (Build.VERSION.SDK_INT >= 23) {
            if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
                    == PackageManager.PERMISSION_GRANTED) {
                Log.v(TAG,"Permission is granted2");
                return true;
            } else {
 
                Log.v(TAG,"Permission is revoked2");
                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
                return false;
            }
        }
        else { //permission is automatically granted on sdk<23 upon installation
            Log.v(TAG,"Permission is granted2");
            return true;
        }
    }

voila le code de AndroidManifist

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.hp.app">
 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW/"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE/"/>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE/"/>
 
 
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
 
</manifest>


ce problème casse la tête , je sais pas est ce que possible de faire ce telechargement avec le telephone ou c'est impossible ,, ou existe le probleme exactement ?????