простая проблема. Я использую веб-просмотр, чтобы показать страницу, где у меня есть фотографии. Проблема в том, что когда я использую намерение с веб-сайтом, который я использую, он просто показывает мне пустую страницу. Я не знаю, где проблема, потому что, когда я использую этот сайт в браузере, он работает. Итак, вот решение, которое я использую
@Override
protected void onCreate(Bundle savedInstanceState) {
themeInfo = getSharedPreferences("THEMECONFIG",0);
themeSetting = themeInfo.getString("theme","Základná");
processer = new ProcessFunction();
try {
ConnectivityManager con = (ConnectivityManager) getSystemService(context.CONNECTIVITY_SERVICE);
NetworkInfo net = con.getActiveNetworkInfo();
String web;
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
if (net != null && net.isConnected()) {
if (processer.isOnline()) {
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
}
@Override
public void onDrawerOpened(View drawerView) {
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_arrow_left));
}
@Override
public void onDrawerClosed(View drawerView) {
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_arrow_right));
}
@Override
public void onDrawerStateChanged(int newState) {
}
});
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
processer = new ProcessFunction();
fab = (FloatingActionButton) findViewById(R.id.fab);
MultiTouchListener touchListener=new MultiTouchListener(this);
fab.setOnTouchListener(touchListener);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!drawer.isDrawerVisible(GravityCompat.START))
{
drawer.openDrawer(Gravity.LEFT);
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_arrow_left));
}
else
{
fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_arrow_right));
}
}
});
if (getIntent().getStringExtra("website") == null) {
web = "http://www.lodkanadeje.maweb.eu/";
} else {
web = getIntent().getStringExtra("website");
}
wv = (WebView) findViewById(R.id.webb);
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
progressBar.getIndeterminateDrawable().setColorFilter(Color.LTGRAY, PorterDuff.Mode.MULTIPLY);
progressBar.setScaleY(0.1f);
progressBar.setScaleX(0.1f);
progressBar.setVisibility(View.VISIBLE);
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setDomStorageEnabled(true);
wv.getSettings().setPluginState(WebSettings.PluginState.ON);
wv.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
progressBar.setVisibility(View.INVISIBLE);
}
});
wv.loadUrl(web);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Hups, niečo je zle :(")
.setMessage("Internet nie je dostupný")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
System.exit(0);
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Button buttonSettings = (Button) toolbar.findViewById(R.id.button_settings);
buttonSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent myIntent = new Intent(MainActivity.this, Settings_activity.class);
MainActivity.this.startActivity(myIntent);
}
});
if(!themeSetting.equals(themeInfo)) {
if (themeSetting.equals("Základná")) {
setTheme(R.style.AppTheme);
processer.changeTheme("Základná", checker, MainActivity.this, navigationView, drawer);
checker = true;
}
if (themeSetting.equals("Matrix")) {
setTheme(R.style.AppThemeMatrixDivider);
processer.changeTheme("Matrix", checker, MainActivity.this, navigationView, drawer);
checker = true;
}
if (themeSetting.equals("Gamers")) {
setTheme(R.style.AppThemeGamersDivider);
processer.changeTheme("Gamers", checker, MainActivity.this, navigationView, drawer);
checker = true;
}
}
} else
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Hups, niečo je zle :(")
.setMessage("Chýba pripojenie k internetu. Zapnite prosím dáta alebo Wi-Fi a spustite aplikáciu znova.")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
System.exit(0);
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
} catch (Exception e) {
Log.e("chyba", e.getMessage());
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Button sett = (Button)findViewById(R.id.button_settings);
TextView text = (TextView)findViewById(R.id.textview);
navigationView.setItemIconTintList(ContextCompat.getColorStateList(MainActivity.this, themeInfo.getInt("setItemIconTintList",R.drawable.menu_text_color_normal) ));
navigationView.setItemTextColor(ContextCompat.getColorStateList(MainActivity.this, themeInfo.getInt("setItemTextColor",R.drawable.menu_text_color_normal) ));
navigationView.setBackgroundDrawable(ContextCompat.getDrawable(MainActivity.this, themeInfo.getInt("setBackgroundDrawable",R.drawable.border_top_bottom_normal) ));
sett.setTextColor(ContextCompat.getColorStateList(MainActivity.this, themeInfo.getInt("settSetTextColor",R.color.colorWhite) ));
text.setTextColor(ContextCompat.getColorStateList(MainActivity.this, themeInfo.getInt("textSetTextColor",R.color.colorDefault) ));
toolbar.setBackground(ContextCompat.getDrawable(MainActivity.this, themeInfo.getInt("toolbarSetBackground",R.color.colorPrimary) ));
toolbar.getNavigationIcon().setColorFilter(getResources().getColor(themeInfo.getInt("toolbarGetNavigationIcon()",R.color.colorWhite)), PorterDuff.Mode.SRC_ATOP);
fab.setBackgroundTintList(ContextCompat.getColorStateList(MainActivity.this, themeInfo.getInt("fabBackground",R.color.colorPrimary)));
}
А вот функция, в которой я выбираю, что делать намеренно
public void MenuProcessing(int id, final Activity context, ProcessFunction processer)
{
if (id == R.id.nav_domov) {
Intent myIntent = new Intent(context, MainActivity.class);
myIntent.putExtra("website","http://lodkanadeje.maweb.eu/");
context.startActivity(myIntent);
} else if (id == R.id.nav_gallery) {
String s = "https://drive.google.com/open?id=redacted";
Intent myIntent = new Intent(context, MainActivity.class);
myIntent.putExtra("website",s);
context.startActivity(myIntent);
} else if (id == R.id.nav_facebook) {
processer.SharingToSocialMedia("com.facebook.katana", context);
} else if (id == R.id.nav_twitter) {
processer.SharingToSocialMedia("com.twitter.android", context);
} else if (id == R.id.nav_mail){
Intent myIntent = new Intent(context, MainActivity2.class);
context.startActivity(myIntent);
} else if (id == R.id.nav_map){
if(!processer.isPermissionGranted(context)){
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Hups, niečo je zle :(")
.setMessage("Neudelili ste povolenie pre zisťovanie polohy. Vrátime vás na pôvodnu stránku. Pre zapnutie povolenia prejdite do nastavení aplikácie.")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
final Activity innerContext = context;
Intent myIntent = new Intent(innerContext, MainActivity.class);
myIntent.putExtra("website", "http://lodkanadeje.maweb.eu/");
innerContext.startActivity(myIntent);
}
})
.setNegativeButton("Nastavenia", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
final Activity innerContext = context;
Intent myIntent = new Intent(innerContext, Settings_activity.class);
innerContext.startActivity(myIntent);
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
if(processer.isPermissionGranted(context)) {
Intent myIntent = new Intent(context, MainActivity3.class);
context.startActivity(myIntent);
}
} else if (id == R.id.nav_instagram){
processer.SharingToSocialMedia("com.instagram.android", context);
} else if (id == R.id.nav_snapchat){
processer.SharingToSocialMedia("com.snapchat.android", context);
}
}
Так. Проблема в том, что когда я использую сайт
"https://drive.google.com/open?id=redacted"
это просто показывает мне пустую страницу. Я проверил почти все решения здесь в стеке, но ни одно из них не помогло мне. Когда я использую
"http://lodkanadeje.maweb.eu/"
работает отлично. Где-то я читал, что https может быть проблемой для просмотра веб-страниц, но я не знаю, верю ли я в это: D
Может кто-нибудь из вас поможет мне с этой проблемой?
Спасибо
PS: сайт находится в R.id.nav_gallery в функции MenuProcessing.