The startactivity() inside the new method is not getting called..i tried inside onclick() method..till i.putextra() method it is executing perfectly
public class First_Fragment extends Fragment{
View myView;
EditText figText;
Button figButton;
String TAG ="com.myapplication.siva.navigation_drawer";
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
myView = inflater.inflate(R.layout.first_layout,container,false);
figText= (EditText) myView.findViewById(R.id.figText);
figButton= (Button) myView.findViewById(R.id.figButton);
Log.i(TAG,"Going inside 1");
figButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
newMethod();
}
});
return myView;
}
public void newMethod()
{
Log.i(TAG,"Going inside 2");
String id=figText.getText().toString();
Log.i(TAG,"Going inside 3");
Intent i = new Intent(getActivity(), webView.class);
Log.i(TAG,"Going inside 4");
i.putExtra("sivMessage",id);
Log.i(TAG,"Going inside 5");
startActivity(i);
}
}
the webview class code is as follows..
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;
public class webView extends ActionBarActivity {
WebView figWeb;
String TAG ="com.myapplication.siva.sasfig";
long num;
String abc;
TextView regNo;
public webView() {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.web_view);
getSupportActionBar().hide();
regNo=(TextView)findViewById(R.id.regNo);
figWeb = ((WebView) findViewById(R.id.figWeb));
WebSettings webSettings = figWeb.getSettings();
webSettings.setBuiltInZoomControls(true);
webSettings.setSupportZoom(true);
webSettings.setJavaScriptEnabled(true);
Bundle man = getIntent().getExtras();
if(man == null){
return;
}
String sivMessage = man.getString("sivMessage");
num=Long.parseLong(sivMessage);
regNo.setText(sivMessage);
figWeb.loadUrl("http://192.6.18/memberaccess1.asp?id="+num);
}
public void onPlus(View view)
{
num+=1;
abc=""+num;
regNo.setText(abc);
figWeb.loadUrl("http://192.6.18/memberaccess1.asp?id="+num);
}
public void onMinus(View view)
{
num-=1;
abc=""+num;
regNo.setText(abc);
figWeb.loadUrl("http://192.6.18/memberaccess1.asp?id="+num);
}
}
Logcat for the code is given below:this isedited log created by me...
09-26 16:51:43.984 17879-17879/com.myapplication.siva.navigation_drawer I/com.myapplication.siva.navigation_drawer﹕ Going inside 1
09-26 16:51:43.984 17879-17879/com.myapplication.siva.navigation_drawer I/com.myapplication.siva.navigation_drawer﹕ Going inside 2
09-26 16:51:43.984 17879-17879/com.myapplication.siva.navigation_drawer I/com.myapplication.siva.navigation_drawer﹕ Going inside 3
09-26 16:51:43.991 17879-17879/com.myapplication.siva.navigation_drawer I/com.myapplication.siva.navigation_drawer﹕ Going inside 4