Open Android setting page Programaticallu

startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
link:http://stackoverflow.com/questions/19517417/opening-android-settings-programmatically
Advertisements

How to Add customize Android DialogFragment

public class ColorDialogFragment extends SherlockDialogFragment {

    public ColorDialogFragment() {
    //You need to provide a default constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, 
                     ViewGroup container,
                     Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dialog_color_picker, container);
    // R.layout.dialog_color_picker is the custom layout of my dialog
    WindowManager.LayoutParams wmlp = getDialog().getWindow().getAttributes();
    wmlp.gravity = Gravity.LEFT;
    return view;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(DialogFragment.STYLE_NO_FRAME, R.style.colorPickerStyle);
    // this setStyle is VERY important.
    // STYLE_NO_FRAME means that I will provide my own layout and style for the whole dialog
    // so for example the size of the default dialog will not get in my way
    // the style extends the default one. see bellow.        
    }

  }

<style name="colorPickerStyle" parent="Theme.Sherlock.Light.Dialog">
    <item name="android:backgroundDimEnabled">false</item>
    <item name="android:cacheColorHint">@android:color/transparent</item>
    <item name="android:windowBackground">@android:color/transparent</item>
</style
i Have done it as :


<style name="colorPickerStyle" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:backgroundDimEnabled">true</item>
    <item name="android:cacheColorHint">@android:color/white</item>
    <item name="android:windowBackground">@android:color/white</item>
</style>
http://stackoverflow.com/questions/14946887/setting-the-size-of-a-dialogfragment

How to Send data from one Fragment to another fragment in android

http://stackoverflow.com/questions/7149802/how-to-transfer-some-data-to-another-fragment

Fragment fragment = new Fragment();
Bundle bundle = new Bundle();
bundle.putInt(key, value);
fragment.setArguments(bundle);
Bundle has put methods for lots of data types. See this

Then in your Fragment, retrieve the data (e.g. in onCreate() method) with:

Bundle bundle = this.getArguments();
int myInt = bundle.getInt(key, defaultValue);

ios pod install

I’m pretty sure you are not in the right directory. Are you sure your .xcodeproj is in the Developer folder? There might be a subfolder you need to navigate to.

The right way to enable CocoaPods in your Project is:

  1. Open Terminal and execute: $ sudo gem install cocoapods
  2. Navigate to your Project folder (I assume in your case it’s cd /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj).
  3. Setup Cocoapod pod setup
  4. Create the Podfile touch Podfile
  5. Open the Podfile open -e Podfile and insert your code for Podfile
  6. Finally install the Podfile pod install

If you follow this instructions everything should work. When opening your project make sure to open the .xworkspacefile.

For more information: http://cocoapods.org/

Android Recycler view Horizontal and vertical Orientation Scroll Controll

mLayoutManager = new LinearLayoutManager(convertView.getContext(),LinearLayoutManager.HORIZONTAL,false);

Complete Example :


import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.dsb.deshipos.Adapter.CatergoryAdapter;
import com.dsb.deshipos.Library.HandlingServer;
import com.dsb.deshipos.Model.Category;
import com.dsb.deshipos.R;

import java.util.ArrayList;

/**
* Created by dynamicsolversbangladesh1 on 3/31/16.
*/
public class ItemListFragment extends Fragment {
private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;

ArrayList categoryArrayList;

HandlingServer handlingServer;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View convertView = inflater.inflate(R.layout.itemslistfragmentlayout, container, false);

mRecyclerView = (RecyclerView) convertView.findViewById(R.id.item_recycler);

// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);

// use a linear layout manager
mLayoutManager = new LinearLayoutManager(convertView.getContext(),LinearLayoutManager.HORIZONTAL,false);
mRecyclerView.setLayoutManager(mLayoutManager);

handlingServer=new HandlingServer(convertView.getContext());
categoryArrayList=handlingServer.getAllCategories();

// specify an adapter (see also next example)
mAdapter = new CatergoryAdapter(convertView.getContext(),categoryArrayList);
mRecyclerView.setAdapter(mAdapter);
return convertView;
}
}

android edittext focus

Focus movement is based on an algorithm which finds the nearest neighbor in a given direction. In rare cases, the default algorithm may not match the intended behavior of the developer.

Change default behaviour of directional navigation by using following XML attributes:

android:nextFocusDown="@+id/.."
android:nextFocusLeft="@+id/.."
android:nextFocusRight="@+id/.."
android:nextFocusUp="@+id/.."

Besides directional navigation you can use tab navigation. For this you need to use

android:nextFocusForward="@+id/.."

To get a particular view to take focus, call

view.requestFocus()

How to add EditText keboard done button

android:imeOptions="actionDone"
android:singleLine="true"

add this two line on EditText

example:

<EditText
android:imeOptions="actionDone"
android:singleLine="true"
android:hint="PASSWORD"
android:paddingLeft="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/round_edittext_corner"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="@+id/editText_password_from_loginByEmailAddress"
android:layout_below="@+id/editText_email_from_loginByEmailAddress"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText_email_from_loginByEmailAddress"
android:layout_alignEnd="@+id/editText_email_from_loginByEmailAddress" />