jeudi 28 mai 2015

How can we use two listview of Checkboxes in Android

I have an application. On the result page there is a button. By clicking the button I want to show a filter option to the users so that they can filter the data !

SampleImage

I am not able to create this layout ,what i have to use for this to create the layout

Please help me with this

App crashes when loading image from gallery

In my app ,i have two buttons ,one for loading the image from gallery(from device )and another one for taking pictures by accesing the camera of the device,My code is working properly on some devices ,bt in some devices ,the app crashes when clicking an image in the gallery.Can anybody help me to find out the actual propblem??

public class MainActivity extends ActionBarActivity {
private static int RESULT_LOAD_IMAGE = 1;
private static final int CAMERA_REQUEST = 1888;
private ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture);
    buttonLoadImage.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {

            Intent i = new Intent(
                    Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

            startActivityForResult(i, RESULT_LOAD_IMAGE);
        }
    });
    this.imageView = (ImageView)this.findViewById(R.id.imgView);
    Button photoButton = (Button) this.findViewById(R.id.button2);
    photoButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(cameraIntent, CAMERA_REQUEST);
        }
    });
}

And the xml is

<LinearLayout xmlns:android="http://ift.tt/nIICcg" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/imgView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"></ImageView>
<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/black" >
<Button android:id="@+id/buttonLoadPicture"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:layout_weight="0"
    android:text="Load Picture"
    android:layout_gravity="center"></Button>
    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Take Picture"
        android:layout_alignParentRight="true"/>

</RelativeLayout>

how to share ideas, code, suggestion in our stackoverflow

I have some useful information i want to share these information, ideas, code, suggestion, and information in our stackoverflow website for programmer to get a lot of help.

like this

Hi Every one I want to share with you people a

special android API Demo code/Project, you would be like my post :), i posted All android API demo you can get a lot of help from this code, It contains more than 1000 of tasks,

The API Demos application includes a variety of small applications that illustrate the use of various Android APIs. It includes samples of

  • Activities
  • Graphic
  • Hardware Related
  • Animations
  • Notifications
  • Alarms
  • Progress Dialogs
  • Intents
  • Menus
  • Search
  • Persistent application state
  • Preferences
  • Background Services
  • App Widgets
  • Voice Recognition
  • Text to Voice
  • And many many more...

Download Source Code for All Android API Demo

how to set time using progress bar in android

I want to create the Dialog with progress bar to show the hours and mins like shown below, is anyone able to help me?

What I want

How to show warning/error if used resource id belongs to another activity layout

Is there a way to show some warning/error when Android resource id does not belong to layout inflated in Activity?

Following is simple example, but in more complex layouts it is much harder to track down such issues as they can only be found during run-time. I would like to be able to catch them at compile-time.

MainActivity initialization

protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // how to prevent erroneous usage of R.id.text2 at compile time
    TextView t = (TextView) findViewById(R.id.text2);
}

activity_main.xml

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
                xmlns:tools="http://ift.tt/LrGmb4"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".MainActivity">

    <TextView android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</RelativeLayout>

activity_second.xml

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
                xmlns:tools="http://ift.tt/LrGmb4"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".SecondActivity">

    <TextView android:id="@+id/text2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</RelativeLayout>

Android Tablelayout Show diferent columns

Good afternoon,

I'm doing a TableLayout and need to know how to have a column that can have text or an image.

That is, if a selected option need to show a picture in this column, if this option is not selected need to show a text.

This variation is row to row. I can have a row with image at this column and text on next row

Transitioning between two activities using slider in android studio

I am creating a friend finding app in Android Studio 1.1.0 which incorporates the Google Maps API. This does not allow me to create any widgets on my current activity so I would like to create a slider (Similar to Facebook app on IOS) in which data can be displayed.

Any help will be appreciated.