[Solved] Which api I use to get Best Near By venues from foursquare [closed]

You can search the venues near by you using the below Rest API.. https://api.foursquare.com/v2/venues/search?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=20140730&locale=en&radius=1000&ll=LAT,LNG&limit=20&query=royal&categoryId=COMMA_SEPERATED_IDS For more details, you can refer the link below: https://developer.foursquare.com/docs/venues/search Also to fetch the specific category from the four square for COMMA_SEPERATED_IDS, you can get it from the below link: https://developer.foursquare.com/docs/venues/categories To create client id and client secret, follow below link: … Read more

[Solved] findViewById returns null and also : where to define my onClick?

the Problem is here: RadioButton rb = (RadioButton) findViewById(R.id.radio32); You should show which view you are getting the RadioButton, it should be something like this: View v = inflater.inflate(R.layout.your_layout, container, false); RadioButton rb = (RadioButton) v.findViewById(R.id.radio32); 1 solved findViewById returns null and also : where to define my onClick?

[Solved] Close activity after x minutes of inactive

Here is a code of Activity that will automatically close itself after five seconds. public class TestActivity extends ActionBarActivity { private static final int DELAY = 5000; public boolean inactive; Handler mHideHandler = new Handler(); Runnable mHideRunnable = new Runnable() { @Override public void run() { if(inactive) { finish(); } else { mHideHandler.postDelayed(mHideRunnable, DELAY); } … Read more

[Solved] How to store the array of string in shared preferences? [closed]

first activity. public class MainActivity extends ActionBarActivity { private Button button; private SharedPreferences preferences; private String[] name = {“aa”, “bb”, “cc”}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button=(Button)findViewById(R.id.button1); preferences=getSharedPreferences(“testarray”, MODE_PRIVATE); for(int i=0;i<3;i++) { SharedPreferences.Editor editor=preferences.edit(); editor.putString(“str”+i, name[i]); editor.commit(); } button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this,Secondact.class)); } }); } … Read more

[Solved] Alert dialog with button throws exception

Use it accordingly AlertDialog.Builder alertbox = new AlertDialog.Builder(YourActivity.this); alertbox.setTitle(“Do you want To exit ?”); alertbox.setPositiveButton(“Yes”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { // finish used for destroyed activity exit(); } }); alertbox.setNegativeButton(“No”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { // Nothing will be happened when clicked on no button … Read more

[Solved] AlertDialog, kill activity onClick “NO” [duplicate]

You need to provide an OnClickListener where you can call finish() for your activity. .setNegativeButton(android.R.string.no, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //replace MainActivity with your activity’s name MainActivity.this.finish(); } }) solved AlertDialog, kill activity onClick “NO” [duplicate]

[Solved] Using onClickListerner() on EditText in Android [closed]

you don’t need onClickListener for EditText, it is mainly needed for buttons. For EditText you can use setOnTouchListener. Then in onTouch check whether previous fields are filled. If not, show error else do the calculation. Read the basics first before trying to develop any app otherwise you will miss many important concepts. 2 solved Using … Read more

[Solved] convert string array into integer array android [closed]

Because Integer.parseInt(urls[i]); is throwing NumberFormatException and you are swallowing the Exception . The below code will not work in your case, but at least you will get to know the error: try{ a[i]=Integer.parseInt(urls[i]); }catch(Exception e){ e.printStackTrace(); throw new RunTimeException(e); } All the elements of a primitive int array are defaulted to 0. Hence you get … Read more

[Solved] How to use a PSD in Android?

First, you need to export your PSD file to a PNG or similar format and put it in your drawable folder. Do the following in your XML: <ProgressBar android:id=”@+id/progressBar1″ style=”?android:attr/progressBarStyleHorizontal” android:progressDrawable=”@drawable/custom_progressbar” android:layout_width=”wrap_content” android:layout_height=”wrap_content” /> At run time do the following // Get the Drawable custom_progressbar Drawable draw=res.getDrawable(R.drawable.custom_progressbar); // set the drawable as progress drawable progressBar.setProgressDrawable(draw) … Read more