Geetha Renown's Profile

61
Points

Questions
28

Answers
2

  • Asked on June 28, 2016 in android.
    TableRow tr1=new TableRow(getApplicationContext());
     TableRow tr2=new TableRow(getApplicationContext());
    rt.addView(tr1, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
     rt.addView(tr2, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    //int ln=heads.length;
     //System.out.println("Length is:"+ln);
     while(stt.hasMoreTokens())
     {
     //System.out.println("In While Loop...");
    TextView tv1=new TextView(getApplicationContext());
     tv1.setBackgroundResource(R.drawable.cell_shaped);
     tv1.setTextColor(Color.RED);
     tv1.setTextSize(20);
     tv1.setPadding(5, 2, 5, 2);
     tv1.setGravity(Gravity.CENTER);
     tv1.setTypeface(Typeface.DEFAULT_BOLD);
    TextView tv2=new TextView(getApplicationContext());
     tv2.setBackgroundResource(R.drawable.cell_shaped);
     tv2.setTextColor(Color.WHITE);
     tv2.setTextSize(20);
     tv2.setPadding(5, 2, 5, 2);
     tv2.setGravity(Gravity.CENTER);
     tv2.setTypeface(Typeface.DEFAULT_BOLD);
    tv1.setText(heads[i]);
    tr1.addView(tv1);
    String mnn=stt.nextToken();
     tv2.setText(mnn);
    tr2.addView(tv2);
     i++;
     System.out.println(" "+mnn);
     }
    

     

    XML

     

    <TableLayout
     android:id="@+id/replt"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:fontFamily="Calibri" >
     </TableLayout>
    
    • 174 views
    • 1 answers
    • 0 votes
  • Asked on June 27, 2016 in android.

    Xml:

    <?xml version="1.0" encoding="utf-8"?>
    <WebView xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/webView1"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     />
    

    Java

    public class Webview_one extends AppCompatActivity{
     private WebView webview;
     private ProgressDialog progressBar;
     @Override
     public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.webload);
    webview = (WebView) findViewById(R.id.webView1);
     WebSettings settings = webview.getSettings();
     settings.setJavaScriptEnabled(true);
     webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    progressBar = ProgressDialog.show(Webview_one.this, "WebView Example", "Loading...");
    webview.setWebViewClient(new WebViewClient() {
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
     Log.i("web", "Processing webview url click...");
     view.loadUrl(url);
     return true;
     }
    public void onPageFinished(WebView view, String url) {
     Log.i("web", "Finished loading URL: " +url);
     if (progressBar.isShowing()) {
     progressBar.dismiss();
     }
     }
    public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
     Log.e("web", "Error: " + description);
     Toast.makeText(getApplicationContext(), "Oh no! " + description, Toast.LENGTH_SHORT).show();
     /*alertDialog.setTitle("Error");
     alertDialog.setMessage(description);
     alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
     public void onClick(DialogInterface dialog, int which) {
     return;
     }
     });
     alertDialog.show();*/
     }
     });
     webview.loadUrl("http://rajandroindian.blogspot.in/2015/08/android-interview-questions.html");
    }
    }
    
    • 196 views
    • 2 answers
    • 0 votes