How to list all files and folders locating on sd card

It seems that when you touch Back dispatchKeyEvent() receive twice the KeyEvent KEYCODE_BACK, so I suggest you do it this way : public class FileList extends ListActivity { private File file; private List<String> myList; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); myList = new ArrayList<String>(); String root_sd = Environment.getExternalStorageDirectory().toString(); file = new File( root_sd + “/external_sd” … Read more

Different delegates for QML ListView

I’ve had the same problem, the Qt documentation is providing a pretty good answer: http://doc.qt.io/qt-5/qml-qtquick-loader.html#using-a-loader-within-a-view-delegate The easiest solution is an inline Component with a Loader to set a source file: ListView { id: contactsView anchors.left: parent.left anchors.top: parent.top width: parent.width height: parent.height orientation: Qt.Vertical spacing: 10 model: contactsModel delegate: Component { Loader { source: switch(position) … Read more

WPF ListView with GridViewColumn and DataTemplate

You need to define the data template as CellTemplate for your column: <ListView x:Name=”lbDatabases” Height=”138″ Width=”498″ Canvas.Left=”44″ Canvas.Top=”146″ > <ListView.View > <GridView > <GridViewColumn Header=”Databases” Width=”498″> <GridViewColumn.CellTemplate> <DataTemplate> <CheckBox IsChecked=”{Binding IsActive}” Checked=”AnyChange” Unchecked=”AnyChange” Style=”{x:Null}” Content=”{Binding DbName}” Width=”{Binding CheckWidth}” /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> </ListView>

Removing muliple items from listview using Check box in Android

Use a SparseBooleanArray to get the checked items and then delete the same and refresh listview. public class MainActivity extends Activity { ListView lv; ArrayAdapter<String> adapter; Button delete; ArrayList<String> data = new ArrayList<String>(); SparseBooleanArray mCheckStates ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); lv = (ListView)findViewById(R.id.listView1); lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); delete = (Button)findViewById(R.id.button1); data.add(“Windows”); data.add(“Android”); data.add(“Apple”); data.add(“Blackberry”); … Read more

Is there any way to Show Google Admob in Android Recycler View

Here is complete example. I just created an example app for you. Main Activity import android.content.Context; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import java.util.ArrayList; import java.util.List; public class Main extends AppCompatActivity { public static final String TAG = Main.class.getSimpleName(); private Context mContext; private List<MyListModel> mList; private RecyclerView mRecyclerView; private RecyclerView.Adapter mAdapter; … Read more