title: EditText Service Class
body: <p>How come EditTexts does not bring up the keyboard by default in a Service class? I have tried so many different methods and not a single one works. No crashes either. I am so confused on why it is so hard to do so. It shows when it is focused on it, but nothing comes from it. Can someone please help me. If you would like more code, please don't hesitate to ask. Here is a code snippet:</p>
  
  <pre><code>        final EditText opHexEdit = new EditText(this);
          RelativeLayout.LayoutParams opHexEditParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opHexEdit.setLayoutParams(opHexEditParam);
          opHexEdit.setHint("Ex: 01 00 A0 E3 1E FF 2F E1");
          LL3.addView(opHexEdit);
  </code></pre>
  
  <p>Here is an image of the output:
  <a href="https://i.stack.imgur.com/lRGBs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lRGBs.png" alt="enter image description here"></a></p>
  
  <p>More code. This is all I will showcase due to how hungry android leechers are:</p>
  
  <pre><code>final RelativeLayout collapsedView = new RelativeLayout(this);
          RelativeLayout.LayoutParams collapsedViewParam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
          collapsedView.setLayoutParams(collapsedViewParam);
          collapsedView.setVisibility(View.VISIBLE);
          menuHolder.addView(collapsedView);
  
          final RelativeLayout expandedView = new RelativeLayout(this);
          RelativeLayout.LayoutParams expandedViewParam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
          expandedView.setLayoutParams(expandedViewParam);
          expandedView.setVisibility(View.GONE);
          expandedView.setBackgroundColor(Color.parseColor("#FF0000"));
          menuHolder.addView(expandedView);
  
          final ImageView pmtIcon = new ImageView(this);
          ViewGroup.LayoutParams pmtIconParam = new ViewGroup.LayoutParams(175, 175);
          pmtIcon.setLayoutParams(pmtIconParam);
          collapsedView.addView(pmtIcon);
          File myFile = new File(Environment.getExternalStorageDirectory().getPath() + "/pmt/images/pmt_icon_round.png");
          Bitmap bmp = BitmapFactory.decodeFile(myFile.getAbsolutePath());
          pmtIcon.setImageBitmap(bmp);
  
          final LinearLayout LL = new LinearLayout(this);
          LinearLayout.LayoutParams LLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          LL.setLayoutParams(LLP);
          LL.setOrientation(LinearLayout.VERTICAL);
          LL.setBackgroundColor(Color.parseColor("#FFFFFF"));
          expandedView.addView(LL);
  
          final LinearLayout LL1 = new LinearLayout(this);
          LinearLayout.LayoutParams LL1P = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          LL1.setLayoutParams(LL1P);
          LL1.setOrientation(LinearLayout.HORIZONTAL);
          LL.addView(LL1);
  
          final TextView opBlankSpaces = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpacesParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpaces.setLayoutParams(opBlankSpacesParam);
          opBlankSpaces.setText("    ");
          opBlankSpaces.setTextSize(26);
          LL1.addView(opBlankSpaces);
  
          final TextView opTitle = new TextView(this);
          RelativeLayout.LayoutParams opTitleParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opTitle.setLayoutParams(opTitleParam);
          opTitle.setTextColor(Color.parseColor("#000000"));
          opTitle.setTextSize(38);
          SpannableString underline = new SpannableString(" Live Offset Patcher ");
          underline.setSpan(new UnderlineSpan(), 0, underline.length(), 0);
          opTitle.setText(underline);
          LL1.addView(opTitle);
  
          final TextView opBlankSpaces1 = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpaces1Param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpaces1.setLayoutParams(opBlankSpaces1Param);
          opBlankSpaces1.setText("    ");
          opBlankSpaces1.setTextSize(26);
          LL1.addView(opBlankSpaces1);
  
          final TextView opBlankSpace = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpaceParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpace.setLayoutParams(opBlankSpaceParam);
          opBlankSpace.setText(" ");
          opBlankSpace.setTextColor(Color.parseColor("#000000"));
          opBlankSpace.setTextSize(12);
          LL.addView(opBlankSpace);
  
          final LinearLayout LL2 = new LinearLayout(this);
          LinearLayout.LayoutParams LL2P = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          LL2.setLayoutParams(LL2P);
          LL2.setOrientation(LinearLayout.HORIZONTAL);
          LL.addView(LL2);
  
          final TextView opOffsetText = new TextView(this);
          RelativeLayout.LayoutParams opOffsetTextParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opOffsetText.setLayoutParams(opOffsetTextParam);
          opOffsetText.setText(" Offset: ");
          opOffsetText.setTextSize(17);
          opOffsetText.setTextColor(Color.parseColor("#000000"));
          LL2.addView(opOffsetText);
  
          final EditText opOffsetEdit = new EditText(this);
          RelativeLayout.LayoutParams opOffsetEditParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opOffsetEdit.setLayoutParams(opOffsetEditParam);
          opOffsetEdit.setHint("Ex: 0x002864AC");
          LL2.addView(opOffsetEdit);
  
          final LinearLayout LL3 = new LinearLayout(this);
          LinearLayout.LayoutParams LL3P = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          LL3.setLayoutParams(LL3P);
          LL3.setOrientation(LinearLayout.HORIZONTAL);
          LL.addView(LL3);
  
          final TextView opHexText = new TextView(this);
          RelativeLayout.LayoutParams opHexTextParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opHexText.setLayoutParams(opHexTextParam);
          opHexText.setText(" Hex: ");
          opHexText.setTextSize(17);
          opHexText.setTextColor(Color.parseColor("#000000"));
          LL3.addView(opHexText);
  
          final EditText opHexEdit = new EditText(this);
          RelativeLayout.LayoutParams opHexEditParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opHexEdit.setLayoutParams(opHexEditParam);
          opHexEdit.setHint("Ex: 01 00 A0 E3 1E FF 2F E1");
          LL3.addView(opHexEdit);
          opHexEdit.requestFocus();
  
          final LinearLayout LL5 = new LinearLayout(this);
          LinearLayout.LayoutParams LL5P = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          LL5.setLayoutParams(LL5P);
          LL5.setOrientation(LinearLayout.HORIZONTAL);
          LL.addView(LL5);
  
          final TextView opLibText = new TextView(this);
          RelativeLayout.LayoutParams opLibTextParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opLibText.setLayoutParams(opLibTextParam);
          opLibText.setText(" Lib: ");
          opLibText.setTextSize(17);
          opLibText.setTextColor(Color.parseColor("#000000"));
          LL5.addView(opLibText);
  
          final EditText opLibEdit = new EditText(this);
          RelativeLayout.LayoutParams opLibEditParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opLibEdit.setLayoutParams(opLibEditParam);
          opLibEdit.setHint("Ex: libil2cpp");
          LL5.addView(opLibEdit);
  
          final TextView opBlankSpace1 = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpace1Param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpace1.setLayoutParams(opBlankSpace1Param);
          opBlankSpace1.setText(" ");
          opBlankSpace1.setTextColor(Color.parseColor("#000000"));
          opBlankSpace1.setTextSize(13);
          LL.addView(opBlankSpace1);
  
          final LinearLayout LL4 = new LinearLayout(this);
          LinearLayout.LayoutParams LL4P = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          LL4.setLayoutParams(LL4P);
          LL4.setOrientation(LinearLayout.HORIZONTAL);
          LL.addView(LL4);
  
          final TextView opBlankSpaces2 = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpaces2Param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpaces2.setLayoutParams(opBlankSpaces2Param);
          opBlankSpaces2.setText("  ");
          opBlankSpaces2.setTextColor(Color.parseColor("#000000"));
          LL4.addView(opBlankSpaces2);
  
          final Button sendItButton = new Button(this);
          RelativeLayout.LayoutParams sendItButtonParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          sendItButton.setLayoutParams(sendItButtonParam);
          sendItButton.setText("   Modify   ");
          sendItButton.setTextSize(17);
          sendItButton.setTextColor(Color.parseColor("#000000"));
          sendItButton.setBackgroundColor(Color.parseColor("#E0E0E0"));
          LL4.addView(sendItButton);
          sendItButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  offset = opOffsetEdit.getText().toString();
                  Toast.makeText(MenuActivity.this, "Offset Patched: " + offset, Toast.LENGTH_SHORT).show();
              }
          });
  
          final TextView opBlankSpaces3 = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpaces3Param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpaces3.setLayoutParams(opBlankSpaces3Param);
          opBlankSpaces3.setText("  ");
          opBlankSpaces3.setTextColor(Color.parseColor("#000000"));
          LL4.addView(opBlankSpaces3);
  
          final Button closeButton = new Button(this);
          RelativeLayout.LayoutParams closeButtonParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          closeButton.setLayoutParams(closeButtonParam);
          closeButton.setText("   Close   ");
          closeButton.setTextSize(17);
          closeButton.setTextColor(Color.parseColor("#000000"));
          closeButton.setBackgroundColor(Color.parseColor("#E0E0E0"));
          LL4.addView(closeButton);
          closeButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  collapsedView.setVisibility(View.VISIBLE);
                  expandedView.setVisibility(View.GONE);
                  Toast.makeText(MenuActivity.this, "Offset Patcher Closed", Toast.LENGTH_SHORT).show();
              }
          });
  
          final TextView opBlankSpace2 = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpace2Param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpace2.setLayoutParams(opBlankSpace2Param);
          opBlankSpace2.setText(" ");
          opBlankSpace2.setTextColor(Color.parseColor("#000000"));
          opBlankSpace2.setTextSize(18);
          LL.addView(opBlankSpace2);
  
          final TextView opCredits = new TextView(this);
          RelativeLayout.LayoutParams opCreditsParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opCredits.setLayoutParams(opCreditsParam);
          opCredits.setText(" ~ Liquified @Platinmods.com");
          opCredits.setTextColor(Color.parseColor("#000000"));
          opCredits.setTextSize(18);
          LL.addView(opCredits);
  
          final TextView opBlankSpace3 = new TextView(this);
          RelativeLayout.LayoutParams opBlankSpace3Param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          opBlankSpace3.setLayoutParams(opBlankSpace3Param);
          opBlankSpace3.setText(" ");
          opBlankSpace3.setTextColor(Color.parseColor("#000000"));
          opBlankSpace3.setTextSize(18);
          LL.addView(opBlankSpace3);
  
          expandedViewF = expandedView;
          collapsedViewF = collapsedView;
  </code></pre>