我在android工作......我是这个领域的新手...我开发了一个webview ...我需要在webview中搜索一个特定的文本...我搜索了一些像t hi s但我的问题没有得到正确的答案
我做了这么多代码但是当执行webview时显示但是我在代码中给出的按钮丢失了
*
private static final int SEARCH_MENU_ID = Menu.FIRST;
@Override
public boolean onCreateOptionsMenu(Menu menu){
super.onCreateOptionsMenu(menu);
menu.add(0, SEARCH_MENU_ID, 0, "Search");
return true;
}
public boolean onPrepareOptionsMenu(Menu menu){
super.onPrepareOptionsMenu(menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case SEARCH_MENU_ID:
search();
return true;
}
return true;
}
public void search(){
container = (LinearLayout)findViewById(R.id.lLayout1);
nextButton = new Button(this);
nextButton.setText("Next");
nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mWebView.findNext(true);
// TODO Auto-generated method stub
}
});
container.addView(nextButton);
closeButton = new …Run Code Online (Sandbox Code Playgroud) 我正在开发一个Android应用程序..实际上我需要设置一个editext条目的最小值和最大值我的最小值是18,最大值是65.I做了这个的确切代码
package com.test;
import android.text.InputFilter;
import android.text.Spanned;
public class InputFilterMinMax implements InputFilter {
private int min, max;
public InputFilterMinMax(int min, int max) {
this.min = min;
this.max = max;
}
public InputFilterMinMax(String min, String max) {
this.min = Integer.parseInt(min);
this.max = Integer.parseInt(max);
}
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
try {
int input = Integer.parseInt(dest.toString() + source.toString());
if (isInRange(min, max, input))
return null;
} catch (NumberFormatException nfe) { }
return …Run Code Online (Sandbox Code Playgroud)