Get field value from PopupScreen back to MainScreen in Blackberry - blackberry

Now i have a MyScreen which extends from MainScreen containing a button. When the button clicked, it will show the PopupScreen containing list of RadioButtonFields, OK and Cancel buttons. My question is how to get RadioButtonField value from PopupScreen back to MyScreen.
Please help me in this case.
Thanks
Below is my code
MyScreen.java
public class MyScreen extends MainScreen{
private int currentValue = 0;
public MyScreen() {
LabelField lblField = new LabelField();
lblField.setText("Current Value = " + currentValue);
ButtonField btnPopup = new ButtonField("Show Popup");
btnPopup.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().pushScreen(new MyPopupScreen());
}
});
add(lblField);
add(btnPopup);
}
}
MyPopupScreen
public class MyPopupScreen extends PopupScreen implements FieldChangeListener {
private int currentValue = -1;
public MyPopupScreen() {
super(new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL|VerticalFieldManager.VERTICAL_SCROLLBAR), Field.FOCUSABLE
);
add(new LabelField("Select Chart Type"));
RadioButtonGroup radioGroup = new RadioButtonGroup();
for (int i = 0; i < 10; i++) {
RadioButtonField radio = new RadioButtonField("Option no. " + i, radioGroup, false);
radio.setChangeListener(this);
add(radio);
}
ButtonField cancelBtn = new ButtonField("Close");
ButtonField okBtn = new ButtonField("OK");
add(okBtn);
add(cancelBtn);
cancelBtn.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().popScreen();
}
});
okBtn.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
//How to get radio value or index value to pass back to MyScreen
}
});
}
public void fieldChanged(Field field, int context) {
if (field instanceof RadioButtonField) {
RadioButtonField radio = (RadioButtonField) field;
currentValue = radio.getIndex();
}
}
}

As Vijay, suggested this is one way that we could achieve this using inner class. The other approach could be, using design observer design patterns.
Try understanding the below code, and use what ever is efficient for you.
MyScreen.java
public class MyScreen extends MainScreen implements MyListener {
MyScreen screen = null;
public MyScreen() {
screen = this;
LabelField lblField = new LabelField();
lblField.setText("Current Value = " + currentValue);
ButtonField btnPopup = new ButtonField("Show Popup");
btnPopup.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().pushScreen(new MyPopupScreen(screen));
}
});
add(lblField);
add(btnPopup);
}
public void valueChanged(int selectedIdx) {
Dialog.alert(selectedIdx );
}
}
MyListener.java
public interface MyListener {
public void valueChanged(int selectedIdx);
}
MyPopupScreen.java
public class MyPopupScreen extends PopupScreen implements FieldChangeListener {
MyScreen deligate = null;
public MyPopupScreen(final MyScreen deligate) {
super(new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL|VerticalFieldManager.VERTICAL_SCROLLBAR), Field.FOCUSABLE);
this.deligate = deligate;
add(new LabelField("Select Type"));
ButtonField closeBtn = new ButtonField("Close");
ButtonField okBtn = new ButtonField("OK");
add(okBtn);
add(closeBtn);
closeBtn.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
}
});
okBtn.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
deligate.valueChanged(radioGroup.getSelectedIndex());
UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
}
});
}
}

public class MyScreen extends MainScreen{
private int currentValue = 0;
String result; // Declare the result
public MyScreen() {
LabelField lblField = new LabelField();
lblField.setText("Current Value = " + currentValue);
ButtonField btnPopup = new ButtonField("Show Popup");
btnPopup.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().pushScreen(new MyPopupScreen());
}
});
ButtonField btnGetResult = new ButtonField("result"); //Add new Button
btnGetResult.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
Dialog.inform(result);
}
});
add(lblField);
add(btnPopup);
add(btnGetResult);// Add button to get the selected index
}
public class MyPopupScreen extends PopupScreen implements FieldChangeListener {
private int currentValue = -1;
RadioButtonField radio;
public MyPopupScreen() {
super(new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL|VerticalFieldManager.VERTICAL_SCROLLBAR), Field.FOCUSABLE
);
add(new LabelField("Select Chart Type"));
final RadioButtonGroup radioGroup = new RadioButtonGroup();
for (int i = 0; i < 10; i++) {
radio = new RadioButtonField("Option no. " + i, radioGroup, false);
radio.setChangeListener(this);
add(radio);
}
ButtonField cancelBtn = new ButtonField("Close");
ButtonField okBtn = new ButtonField("OK");
add(okBtn);
add(cancelBtn);
cancelBtn.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().popScreen(MyPopupScreen.this);
}
});
okBtn.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
result = radioGroup.getSelectedIndex()+"";
UiApplication.getUiApplication().popScreen(MyPopupScreen.this);
}
});
}
public void fieldChanged(Field field, int context) {
if (field instanceof RadioButtonField) {
RadioButtonField radio = (RadioButtonField) field;
currentValue = radio.getIndex();
}
}
}
}

Related

viewholder onclickListener null object reference

Attempt to invoke interface method 'void com.example.imovie.adapter.MovieItemClickListener.onMovieClick(com.example.imovie.models.Movie, android.widget.ImageView)' on a null object reference
public class MovieAdapter extends RecyclerView.Adapter<MovieAdapter.MyViewHolder> {
Context context ;
List<Movie> mData;
MovieItemClickListener movieItemClickListener;
public MovieAdapter(Context context, List<Movie> mData, MovieItemClickListener listener) {
this.context = context;
this.mData = mData;
movieItemClickListener = listener;
}
#NonNull
#Override
public MyViewHolder onCreateViewHolder(#NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(context).inflate(R.layout.item_movie,viewGroup,false);
return new MyViewHolder(view);
}
#Override
public void onBindViewHolder(#NonNull MyViewHolder myViewHolder, int i) {
myViewHolder.TvTitle.setText(mData.get(i).getTitle());
myViewHolder.ImgMovie.setImageResource(mData.get(i).getThumbnail());
}
#Override
public int getItemCount() {
return mData.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
private TextView TvTitle;
private ImageView ImgMovie;
public MyViewHolder(#NonNull View itemView) {
super(itemView);
TvTitle = itemView.findViewById(R.id.item_movie_title);
ImgMovie = itemView.findViewById(R.id.item_movie_img);
itemView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
movieItemClickListener.onMovieClick(mData.get(getAdapterPosition()),ImgMovie);//i have a null object reference
}
});
}
}
}
public class HomeFragment extends Fragment implements MovieItemClickListener {
private HomeViewModel homeViewModel;
private List<Slide> listSlides;
private ViewPager slidePager;
private TabLayout indicator;
private RecyclerView moviesRV;
private RecyclerView moviesRV2;
private MovieItemClickListener movieItemClickListener;
public View onCreateView(#NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
slidePager = root.findViewById(R.id.slider_pager);
indicator = root.findViewById(R.id.indicator);
moviesRV = root.findViewById(R.id.rsViewMovies);
moviesRV2 = root.findViewById(R.id.rsViewMovies2);
iniSlider();
final SliderPagerAdapter sliderPagerAdapteradapter = new SliderPagerAdapter(getContext(), listSlides);
final MovieAdapter movieAdapter = new MovieAdapter(getContext(), DateSource.getPopularMovies(), movieItemClickListener);
final Timer timer = new Timer();
timer.scheduleAtFixedRate(new SliderTimer(), 4000, 6000);
homeViewModel.getText().observe(this, new Observer<String>() {
#Override
public void onChanged(#Nullable String s) {
slidePager.setAdapter(sliderPagerAdapteradapter);
indicator.setupWithViewPager(slidePager, true);
moviesRV.setAdapter(movieAdapter);
moviesRV.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
moviesRV2.setAdapter(movieAdapter);
moviesRV2.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
}
});
return root;
}
#Override
public void onMovieClick(Movie movie, ImageView imageView) {
Intent intent = new Intent(getContext(), MovieDetailActivity.class);
intent.putExtra("title", movie.getTitle());
intent.putExtra("imgURL", movie.getThumbnail());
intent.putExtra("imgCover", movie.getCoverPhoto());
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getActivity(),
imageView, "sharedName");
startActivity(intent, options.toBundle());
Toast.makeText(getContext(), "item clicked : " + movie.getTitle(), Toast.LENGTH_LONG).show();
}
class SliderTimer extends TimerTask {
#Override
public void run() {
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
#Override
public void run() {
if (slidePager.getCurrentItem() < listSlides.size() - 1) {
slidePager.setCurrentItem(slidePager.getCurrentItem() + 1);
} else {
slidePager.setCurrentItem(0);
}
}
});
}
}
}
private void iniSlider() {
listSlides = new ArrayList<>();
listSlides.add(new Slide(R.drawable.a, "slide title \n movie title"));
listSlides.add(new Slide(R.drawable.b, "slide title"));
listSlides.add(new Slide(R.drawable.a, "slide title \n movie title"));
listSlides.add(new Slide(R.drawable.b, "slide title"));
}
}
If I'm not wrong, HomeFragment.movieItemClickListener is never initialized.
You may want to make the following changes in HomeFragment:
1. Delete the line
private MovieItemClickListener movieItemClickListener;
2. In this line
final MovieAdapter movieAdapter = new MovieAdapter(getContext(), DateSource.getPopularMovies(), movieItemClickListener);
change movieItemClickListener to this, because HomeFragment implements MovieItemClickListener.
That should fix the NullPointerException.

Checkbox enable EditText in RecyclerView issue

I am working for quiz app project. I've got a RecyclerView, each of them contains TextView, two Checkbox and EditText. What I want is when i checked the second Checkbox it will enable the EditText. I have already make this work. but the problem is if I Checked the Checkbox and Type something in the EditText on the first row, when I scroll down some of the others are mirroring the EditText state even I am not Checked the Checkbox to enable EditText of that row.
here is my adapter code:
public class StudentAdapter extends RecyclerView.Adapter<StudentAdapter.StudentViewHolder> {
private LayoutInflater inflator;
private int status;
Typeface typeface;
List<Student> students = Collections.emptyList();
public StudentAdapter(Context context, List<Student> students, String Font) {
inflator = LayoutInflater.from(context);
this.students = students;
typeface = Typeface.createFromAsset(context.getAssets(), Font);
}
#Override
public StudentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflator.inflate(R.layout.student_row, parent, false);
StudentViewHolder studentViewHolder = new StudentViewHolder(view);
return studentViewHolder;
}
#Override
public void onBindViewHolder(final StudentViewHolder holder, final int position) {
final Student currentStudent = students.get(position);
holder.studentName.setText(currentStudent.student);
holder.chbIllegal.setTag(students.get(position));
holder.editText.setTag(students.get(position));
holder.chbIllegal.setChecked(students.get(position).isSelected());
holder.chbIllegal.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
CheckBox cb = (CheckBox) v;
final Student contact = (Student) cb.getTag();
contact.setSelected(cb.isChecked());
students.get(position).setSelected(cb.isChecked());
// this will enable editText if checkbox is checked
if (cb.isChecked()) {
holder.editText.setEnabled(true);
holder.editText.addTextChangedListener(new TextWatcher() {
#Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
#Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
#Override
public void afterTextChanged(Editable s) {
String Illegal = holder.editText.getText().toString();
contact.setAgaints_rule(Illegal);
Log.d("GExam", currentStudent.student + " " + Illegal);
}
});
holder.chbIllegal.setOnClickListener(null);
holder.chbIllegal.setTag(students.get(position));
} else {
holder.editText.setEnabled(false);
}
}
});
if (currentStudent.getStatus() == 1) {
holder.chbPresent.setChecked(true);
} else if (currentStudent.getStatus() == 0) {
holder.chbPresent.setChecked(false);
}
}
#Override
public int getItemCount() {
return students.size();
}
class StudentViewHolder extends RecyclerView.ViewHolder {
TextView studentName;
CheckBox chbPresent, chbIllegal;
EditText editText;
public StudentViewHolder(View itemView) {
super(itemView);
studentName = (TextView) itemView.findViewById(R.id.StudentlistText);
this.studentName.setTypeface(typeface);
editText = (EditText) itemView.findViewById(R.id.edtAgaintsRule);
chbPresent = (CheckBox) itemView.findViewById(R.id.chbPresent);
// chbIllegal will handle the editText
chbIllegal = (CheckBox) itemView.findViewById(R.id.chbIllegal);
editText.setEnabled(false);
}
}
public List<Student> getStudentList() {
return students;
}
}
How can I only enable EditText of the row that checkbox is checked?
Finally I've been able to solve my problem by my teacher helped. what I have changed is I move the listener from onBindViewHolder to my ViewHolder class like this:
public class StudentAdapter extends RecyclerView.Adapter<StudentAdapter.StudentViewHolder> {
private LayoutInflater inflator;
private int status;
Typeface typeface;
List<Student> students = Collections.emptyList();
public StudentAdapter(Context context, List<Student> students, String Font) {
inflator = LayoutInflater.from(context);
this.students = students;
typeface = Typeface.createFromAsset(context.getAssets(), Font);
}
#Override
public StudentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflator.inflate(R.layout.student_row, parent, false);
StudentViewHolder studentViewHolder = new StudentViewHolder(view);
return studentViewHolder;
}
#Override
public void onBindViewHolder(final StudentViewHolder holder, final int position) {
final Student currentStudent = students.get(position);
holder.studentName.setText(currentStudent.student);
holder.chbIllegal.setTag(students.get(position));
holder.editText.setTag(students.get(position));
holder.editText.setText(currentStudent.getAgaints_rule());
if (currentStudent.isSelected()) {
holder.editText.setEnabled(true);
}else{
holder.editText.setEnabled(false);
}
holder.chbIllegal.setChecked(students.get(position).isSelected());
if (currentStudent.getStatus() == 1) {
holder.chbPresent.setChecked(true);
} else if (currentStudent.getStatus() == 0) {
holder.chbPresent.setChecked(false);
}
}
#Override
public int getItemCount() {
return students.size();
}
class StudentViewHolder extends RecyclerView.ViewHolder {
TextView studentName;
CheckBox chbPresent, chbIllegal;
EditText editText;
public StudentViewHolder(View itemView) {
super(itemView);
studentName = (TextView) itemView.findViewById(R.id.StudentlistText);
this.studentName.setTypeface(typeface);
editText = (EditText) itemView.findViewById(R.id.edtAgaintsRule);
chbPresent = (CheckBox) itemView.findViewById(R.id.chbPresent);
chbIllegal = (CheckBox) itemView.findViewById(R.id.chbIllegal);
chbIllegal.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
CheckBox cb = (CheckBox) v;
Student s = (Student) v.getTag();
Log.e("GExam", String.valueOf(cb.isChecked()));
s.setSelected(cb.isChecked());
StudentViewHolder.this.editText.setEnabled(cb.isChecked());
}
});
editText.addTextChangedListener(new TextWatcher() {
#Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
#Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
#Override
public void afterTextChanged(Editable s) {
Student student = (Student) StudentViewHolder.this.editText.getTag();
student.setAgaints_rule(s.toString());
}
});
}
}
public List<Student> getStudentList() {
return students;
}
}

Java Blackberry Refresh Field Label

I have a main class and a screen class. I have a button that launches a datepicker. When the datepicker is closed I need the label of the button to be refreshed with the selected value. How should I do that?
I tried with invalidate, creating a CustomButtonField that implements different onFocus, onUnFocus, and some other stuff but I guess I implemented them in a wrong way...
My two clases are these ones...
Main...
public class TestClass extends UiApplication
{
public static Calendar alarm1time = Calendar.getInstance(TimeZone.getTimeZone("GMT-3"));
public static void main(String[] args)
{
TestClass testClass = new TestClass ();
testClass.enterEventDispatcher();
}
public TestClass()
{
pushScreen(new TestClassScreen());
}
}
Screen...
public final class TestClassScreen extends MainScreen
{
public TestClassScreen()
{
ButtonField alarm1 = new ButtonField("Alarm : " + TestClass.alarm1time.get(Calendar.HOUR_OF_DAY) + ":" + TestClass.alarm1time.get(Calendar.MINUTE) ,ButtonField.FOCUSABLE)
{
public boolean navigationClick (int status , int time)
{
datePicker(1);
return true;
}
};
setTitle("Test Alarm");
add(new RichTextField(" "));
add(alarm1 );
}
public void datePicker(final int alarmNumber)
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
DateTimePicker datePicker = null;
datePicker = DateTimePicker.createInstance(TestClass.alarm1time, null, "HH:mm");
if(datePicker.doModal())
{
Calendar cal = datePicker.getDateTime();
TestClass.alarm1time = cal;
//Here I need the label to be refreshed, after the datePicker is Ok
}
}
});
}
}
I found one way in the Blackberry Development Forum...
public boolean navigationClick (int status , int time)
{
datePicker(1, this);
return true;
}
public void datePicker(final int alarmNumber, final ButtonField buttonToUpdate)
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
DateTimePicker datePicker = null;
datePicker = DateTimePicker.createInstance(TestClass.alarm1time, null, "HH:mm");
if(datePicker.doModal())
{
Calendar cal = datePicker.getDateTime();
TestClass.alarm1time = cal;
buttonToUpdate.setLabel(....)
}
}
});
}
A more usual way would be to have change listener listen for Button Clicks and do similar processing in there.
I think, this helps you:
public class Def extends MainScreen
{
ButtonField show;
LabelField label;
String str="";
ObjectChoiceField choiceField;
public Def()
{
createGUI();
}
private void createGUI()
{
String st_ar[]={"Date Picker"};
choiceField=new ObjectChoiceField("Select Date: ", st_ar)
{
protected boolean navigationClick(int status, int time)
{
DateTimePicker datePicker = DateTimePicker.createInstance( Calendar.getInstance(), "yyyy-MM-dd", null);
datePicker.doModal();
Calendar calendar=datePicker.getDateTime();
str=String.valueOf(calendar.get(Calendar.DAY_OF_MONTH))+"-"+String.valueOf(calendar.get(Calendar.MONTH)+1)+"-"+calendar.get(Calendar.YEAR);
return true;
}
};
add(choiceField);
label=new LabelField("",Field.NON_FOCUSABLE);
add(label);
show=new ButtonField("Show");
show.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field, int context)
{
label.setText("Time is: "+str);
}
});
add(show);
}
}

Switch to new screen when one of the ObjectChoiceField is selected in black berry

Can any one tell me how to switch to another screen when one of ObjectChoiceField is selected.
Thank You.
final class HelloWorldScreen extends MainScreen implements FieldChangeListener
{
ObjectChoiceField choice=null;
public HelloWorldScreen()
{
super();
String choicestrs[] = {"Opt 1", "Opt 2", "Opt 3"};
choice = new ObjectChoiceField("Object Choice Field: ", choicestrs, 0);
choice.setChangeListener(this);
add(choice);
}
public void openAnotherForm(){
AnotherForm newScreen = new AnotherForm();
UiApplication.getUiApplication().pushScreen(newScreen);
}
public void fieldChanged(Field arg0, int arg1) {
openAnotherForm();
}
}
class AnotherForm extends MainScreen
{
public AnotherForm()
{
super();
add(new LabelField("Another Form"));
}
}

BlackBerry BrowserField IllegalStateException

I'm trying to implement simple user interaction with field2.BrowserField: when button is clicked BrowserField loads
another page, but I'm getting IllegalStateException.
here's my code:
public class BrowserScreen extends MainScreen {
private BrowserField browser;
public BrowserScreen() {
super();
setTitle("Browser State example");
ButtonField btn1 = new ButtonField("test1");
btn1.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
test1();
}
});
add(btn1);
ButtonField btn2 = new ButtonField("test2");
btn2.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
test2();
}
});
add(btn2);
browser = new BrowserField();
add(browser);
browser.requestContent("http://stackoverflow.com/" + ";deviceside=true;");
}
private void test1() {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
browser.requestContent("http://www.blackberry.com/developers" + ";deviceside=true");
}
});
}
private void test2() {
synchronized (Application.getEventLock())
{
browser.requestContent("http://www.blackberry.com/developers" + ";deviceside=true");
}
}
}
Try this one:
public class BrowserScreen extends MainScreen {
private BrowserField browser;
public BrowserScreen() {
super();
setTitle("Browser State example");
ButtonField btn1 = new ButtonField("test1");
btn1.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
//test1();
test1("http://www.blackberry.com/developers");
}
});
add(btn1);
ButtonField btn2 = new ButtonField("test2");
btn2.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
//test2();
test1("http://www.blackberry.com/developers");
}
});
add(btn2);
browser = new BrowserField();
add(browser);
//browser.requestContent("http://stackoverflow.com/" + ";deviceside=true;");
test1("http://stackoverflow.com/");
}
private void test1(final String url) {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
//browser.requestContent("http://www.blackberry.com/developers" + ";deviceside=true");
browser.requestContent(url + ";deviceside=true");
}
});
}
// private void test2() {
// synchronized (Application.getEventLock())
// {
// browser.requestContent("http://www.blackberry.com/developers" + ";deviceside=true");
// }
// }
}
Wow, adding browser.setFocus(); do the trick
public class BrowserScreen extends MainScreen {
private BrowserField browser;
public BrowserScreen() {
super();
setTitle("Browser State example");
ButtonField btn1 = new ButtonField("test1", ButtonField.CONSUME_CLICK);
btn1.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
test1();
}
});
add(btn1);
browser = new BrowserField();
add(browser);
browser.requestContent("http://stackoverflow.com/" + ";deviceside=true;");
}
private void test1() {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
browser.setFocus();
browser.requestContent("http://www.blackberry.com/developers" + ";deviceside=true");
}
});
}
}

Resources