So i made an app for my school's website, the problem is, that my app can not download files if it is linked or uploaded on the website. I am pretty new to coding so i dont know much, so can someone guide me the set of codes required to download files from my app. I am using android studio, thanks
This is the main activity file import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView mywebview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mywebview = (WebView) findViewById(R.id.webview);
WebSettings websettings = mywebview.getSettings();
websettings.setJavaScriptEnabled(true);
mywebview.loadUrl("http://ift.tt/2buKaIo" );
mywebview.setWebViewClient(new WebViewClient());
WebSettings webSettings = mywebview.getSettings();
webSettings.setJavaScriptEnabled(true);
}
public void onBackPressed() {
if(mywebview.canGoBack()){
mywebview.goBack();
} else {
}
super.onBackPressed();
}
public void onWindowFocusChanged(boolean hasFocus){
super.onWindowFocusChanged(hasFocus);
View decorView = getWindow().getDecorView();
if(hasFocus){
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
}
}
Aucun commentaire:
Enregistrer un commentaire