Json'dan Webview'e url çekmek
15.04.2016 - 02:43
ARKADAŞLAR AŞAĞIDA JAVA DOSYAMI VERDİM. WEBVİEW İÇİN KULLANIYORUM. ADRES KISMINI JSON DOSYAMDAN ÇEKMEK İSTİYORUM
JSON ADRESİM
http://yazbiryere.com/Ozkan356.php BU ADRESTEKİ İD:54 TEKİ SOYAD KISMINDAKİ ADRESİ KULLANMAK İSTİYORUM BUNU: http:\/\/ipcamlive.com\/player\/player.php?alias=56fe6f1bbb284&autoplay=0&mute=0
ADIM ADIM NE YAPMAM GEREKTİĞİNİ YAZARMISINIZ. JAVA DOSYAMIN İÇİNE KODLARI YAZARSANIZ DAHA MEMUN OLURUM. GÜNLERDİR HALLEDEMEDİM.
package com.yazbiryere.clk;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class UcuncuEkran extends AppCompatActivity {
private WebView mWebView;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ucuncu_ekran);
mWebView = (WebView) findViewById(R.id.webView);
assert mWebView != null;
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("BURAYA JSON DOSYAMDAKİ ADRESİ ÇEKMEK İSTİYORUM");
mWebView.setWebViewClient(new HelloWebViewClient());
}
private class HelloWebViewClient extends WebViewClient{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url)
{
webView.loadUrl(url);
return true;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{ //if back key is pressed
if((keyCode == KeyEvent.KEYCODE_BACK)&& mWebView.canGoBack())
{
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
23
Görüntülenme
0 Beğeni