ListView вроде как не подходит — в нём кликабельна вся строка
ListView listView = (ListView) findViewById(R.id.listView);
ListAdapter adapter = new ListAdapter() {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return LayoutInflater.from(getApplicationContext()).inflate(R.layout.list_item, null);
}
@Override public boolean areAllItemsEnabled() {return false;}
@Override public boolean isEnabled(int position) {return false;}
@Override public void registerDataSetObserver(DataSetObserver observer) {}
@Override public void unregisterDataSetObserver(DataSetObserver observer) {}
@Override public int getCount() {return 20;}
@Override public Object getItem(int position) {return null;}
@Override public long getItemId(int position) {return 0;}
@Override public boolean hasStableIds() {return false;}
@Override public int getItemViewType(int position) {return 0;}
@Override public int getViewTypeCount() {return 20;}
@Override public boolean isEmpty() {return false;}
};
listView.setAdapter(adapter);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView = (TextView) findViewById(R.id.textView);
File sdCard = Environment.getExternalStorageDirectory();
File[] list = sdCard.listFiles();
for (File f : list) {
String fileAbsPath = f.getAbsolutePath().toString();
fileAbsPath = fileAbsPath.replaceAll("[^\\x20-\\x7e]", "");
textView.append(fileAbsPath);
textView.append("\n");
}
textView.append("\n");
for (File f : list) {
String fileAbsPath = f.getAbsolutePath().toString();
textView.append(fileAbsPath);
textView.append("\n");
}
}
import gnu.jel.CompilationException;
import gnu.jel.CompiledExpression;
import gnu.jel.Evaluator;
import gnu.jel.Library;
public class Main {
private static final String EVAL_VALUE = "3243-854+6-100";
public static void main(String[] args){
JELSample();
}
private static void JELSample(){
try {
Class[] staticLib = new Class[1];
staticLib[0] = Class.forName("java.lang.Math");
Library lib = new Library(staticLib, null, null, null, null);
CompiledExpression compiledExpression = Evaluator.compile(EVAL_VALUE, lib);
Object result = compiledExpression.evaluate(null);
System.out.println("JEL: " + result);
} catch (CompilationException e) {
e.printStackTrace();
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
}