これは私が持っているコードです。
私のメインの.javaファイル。
public void showQuiz (View view){
Username = (EditText) findViewById(R.id.Username);
String userId = Username.getText().toString();
String deviceId = Secure.getString(this.getContentResolver(),
Secure.ANDROID_ID);
//this intent is used to open other activity wich contains another webView
Intent intent = new Intent(this, Quiz.class);
Bundle bun = new Bundle();
bun.putString("userid",userId);
bun.putString("deviceid", deviceId);
intent.putExtras(bun);
startActivity(intent);
}
これは、アクティビティの.javaファイルにあるものです。
package com.earn.egpt;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class Quiz extends Activity {
private static final String url = "http://www.m.s-w-family.com/?subid=";
private static final String url2 = "&deid=";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz);
Bundle extras=getIntent().getExtras();
String userId=extras.getString("userId");
String deviceId=extras.getString("deviceId");
WebView webview;
webview = (WebView) findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl(url+userId+url2+deviceId);
}
}
何らかの理由で文字列をnullとして渡していますが、理由はわかりません。私はこの種のプログラミングに非常に慣れていないので、どこにいるのかさえわかりません。私は私のような他の問題を調べてそれらの修正を試みましたが、値はまだnullです。