Use convertview for different layout but no change the xml value

171 views Asked by At

How to match string on different layout of page indicator like fist.xml ,second.xml and third.xml on button click .I am using convertview but doesnot bold the value of each layout xml.

 mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View convertView1 = mInflater.inflate(R.layout.first_screen,null);

// this is the converview

String strfistsearch=   mylist.get(9).get("data1");  
      Log.v("strfistsearch", strfistsearch);
    if(strfistsearch.equals(strfistsearch))
      {   
             mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              View   convertView1 = mInflater.inflate(R.layout.first_screen,null);        
               TextView txtf = (TextView)convertView1.findViewById(R.id.textView1);

     SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch);
    final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text 
    sb.setSpan(bss, 0, 2, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold 
    sb.setSpan(iss, 4, 6, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make last 2 characters Italic
    sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 2, 0);
    txtf.setText(sb);

       }
    else if(strfistsearch.equals(strfistsearch))
       {
               mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              View   convertView1 = mInflater.inflate(R.layout.first_screen,null);        
               TextView txtf = (TextView)convertView1.findViewById(R.id.textView1);  
     SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch);
    final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text 
    sb.setSpan(bss, 0, 2, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold 
    sb.setSpan(iss, 4, 6, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make last 2 characters Italic
    sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 2, 0);
    txtf.setText(sb);

    }

    else if(strfistsearch.equals(strfistsearch))
    {
             mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              View   convertView1 = mInflater.inflate(R.layout.first_screen,null);        
               TextView txtf = (TextView)convertView1.findViewById(R.id.textView1);  
     SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch);
    final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text 
    sb.setSpan(bss, 0, 2, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold 
    sb.setSpan(iss, 4, 6, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make last 2 characters Italic
    sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 2, 0);
    txtf.setText(sb);
    }

How to fix this issue ..Thanks in Advance..

0

There are 0 answers