package com.example.Calc;
import android.R.string;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class modes extends ListActivity {
/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "Simple Calculator", "Tip Calculator", "Mortgage Calculator", "BMI",
"GPA Calculator"};
// Create an ArrayAdapter, that will actually make the Strings above
// appear in the ListView
this.setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, names));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
string content;
if( content ="Simple Calculator")
{
// When clicked, Open the Next Screen
Intent r=new Intent(modes.this ,simplecalculator.class );
}
}
}
Getting error on if( content =”simple calculator”)
I want when i click simple calculator it should take me to other screen.. i have defined everything, but i forgot the if condition thing.. everything is done.. its just whats the condition for if..
please help and thanks for your time.
A few things:
1) Please use CamelCase for your class names.
2) String starts with a captial letter (as should all Java classes).
That’s it.