Note that there are some explanatory texts on larger screens.

plurals
  1. POStatic Array of string must be converted from database
    primarykey
    data
    text
    <p>this might be a long message but i would like to give a clear question for all of stackoverflow user. What I did is create a static String of array inside a class that is binded on my gridview</p> <pre><code>class ParserArrayList { //some declaration and codes here private String [] imageCaptionId = { "My First Medal", "You ...", "The ...", "Gimme ...", "A ...", "Seven ...", ".....City", ".... Madness", "Loyal...", ".....", "...", "Champion..." }; } </code></pre> <p>And manually binding it on public class ImageAdapter extends BaseAdapter</p> <pre><code>public class ImageAdapter extends BaseAdapter{ //some declaration and variables here public View getView(int position, View convertView, ViewGroup parent) { View v; ParserArrayList arrayImage = new ParserArrayList(); String[] imagetext = arrayImage.getImageCaptionId(); if (convertView == null) { //some stuff here } //some stuff here return v; } </code></pre> <p>As you see I am calling ParserArrayList's 'imageCaptionId' and sends it to another string of array in which i declare 'imagetext '</p> <p>Everything works fine until I found out that the array 'imageCaptionId' must be based on local database Ive tried using this code but I cant finish because</p> <pre><code>class ParserArrayList { //added this code public SQLiteAdapter sqlAdapter; //and this one public void showData(){ sqlAdapter = new SQLiteAdapter(this); String str = "Select dTitle from achievement_tb where version =0 order by ID ASC;"; sqlAdapter.openToRead(); Cursor c =sqlAdapter.read(str); sqlAdapter.close(); } } </code></pre> <p>First: I dont know how to bind it to array</p> <p>Second: I created it inside ParserArrayList and it gives me an error saying <strong>The constructor SQLiteAdapter(ParserArrayList) is undefined</strong> (This is already done)</p> <p>Could you help me sir</p> <p><strong>EDIT</strong> This is what I am trying to accomplish or my logic</p> <p>on my ParserArrayList class I am trying to add this code (I dont know if this is correct)</p> <pre><code> public String[] showImageCaption(){ String imageCaptionIds []; sqlAdapter = new SQLiteAdapter(mContext); String str = "Select dTitle from achievement_tb where version =0 order by ID ASC;"; sqlAdapter.openToRead(); Cursor c =sqlAdapter.read(str); imageCaptionIds [c.getCount()]; sqlAdapter.close(); return imageCaptionIds; } </code></pre> <p>which gives me an error saying <strong>Syntax error, insert "AssignmentOperator Expression" to complete Expression</strong></p> <p>now on my ImageAdapter extends BaseAdapter here is my codes</p> <pre><code> public View getView(int position, View convertView, ViewGroup parent) { View v; ParserArrayList arrayImage = new ParserArrayList(mContext); newArrayList2 = arrayImage.getArraylist(); **String[] imagetext = arrayImage.showImageCaption();** if (convertView == null) { // if it's not recycled, initialize some attributes LayoutInflater li = getLayoutInflater(); v = li.inflate(R.layout.medal_grid, null); } else { v = convertView; } TextView tv = (TextView) v.findViewById(R.id.grid_item_label); **tv.setText(imagetext[position]);** ImageView iv = (ImageView)v.findViewById(R.id.grid_item_image); iv.setImageResource((Integer) newArrayList2.get(position)); return v; } </code></pre> <p>My logic is that I will bind it on my array of String inside ParserArrayList (in which it will return imageCaptionIds) and set it on a textview</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload