Skip to main content

Posts

Adding fragment without UI

Recent posts

Fragments

A Fragment represents a behavior or a portion of user interface in an Activity . A fragment must always be embedded in an activity and the fragment's life cycle is directly affected by the host activity's life cycle.  You can insert a fragment into your activity layout by declaring the fragment in the activity's layout file, as a <fragment> element, or from your application code by adding it to an existing ViewGroup .  We can also use a fragment without its own UI as an invisible worker for the activity.  Fragments can be added, removed, replaced, and animated inside an Activity dynamically.  Fragment API Level Fragment introduced in Honeycomb (Android 3.0) API level 11 Purpose  support more dynamic and flexible UI designs on large screens  promote re usability .  key classes Fragment FragmentManager FragmentTransaction Step of Creating Fragment Step-1 Create a subclass of fragment Step-2 Adding a user interface

Target "Unknown" in android Device Chooser ..Eclipse

Problem Eclipse not recognize my device target Solution A Rest the ADB Open the DDMS perspective  Reset the ADB  Solution B Restart the eclipse Solution C Restart the device Note: if there is any other solution ,Please share with me . Thanks 

Edit Text Problem in android

Problem Statement  I had set background image for EditText. But when the user clicks on EditText the starting point of cursor is appeared before the EditText background image and it looks abnormal. Solution  A: Set the EditText left padding Solution  B: Use the 9 patch background image Note:if there is  any other solution please  share with  me .Thanks 

Exclamation Mark with Android Project Name in Eclipse

Solution A Check errors window. Try to solve the error there Solution B Right click the project,  select Android and make sure that a build target is checked. sometimes you need to unchecked it, select a different API, apply settings, and then again select the API that was originally selected. Solution C Restart the eclipse Note :If none of the above solution work then find new one  and tell me  about the new solution in comments .thanks

Alert Dialog code snippets

    AlertDialog.Builder alert = new AlertDialog.Builder(AlarmActivity.this);         View view = LayoutInflater.from(getBaseContext()).inflate(                 R.layout.dialog_outofrange_values, null);         alert.setTitle(getString(R.string.invalid))                 .setIcon(android.R.drawable.ic_dialog_alert)                 .setMessage(getString(R.string.values_out_of_range))                 .setView(view).setNegativeButton(getString(R.string.ok), null)                 .show();

Progress Dialog Code Snippet

public ProgressDialog pro_dialog; public void progressDialog() {         pro_dialog = new ProgressDialog(this);         pro_dialog.setMessage("Loading");         pro_dialog.setCancelable(true);         pro_dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);         pro_dialog.show();     } For Dismissing the Progress Dialogue pro_dialog.dismiss();