Click here to Skip to main content
15,890,512 members
Home / Discussions / Android
   

Android

 
SuggestionRe: TutorialObjectTracking-master Pin
David Crow10-Feb-16 6:58
David Crow10-Feb-16 6:58 
QuestionInsert Images in EditText as in Notes app in Android Mobiles Pin
Tirumaleswara Reddy.K4-Feb-16 2:16
Tirumaleswara Reddy.K4-Feb-16 2:16 
QuestionRe: Insert Images in EditText as in Notes app in Android Mobiles Pin
David Crow4-Feb-16 6:21
David Crow4-Feb-16 6:21 
AnswerRe: Insert Images in EditText as in Notes app in Android Mobiles Pin
Tirumaleswara Reddy.K4-Feb-16 18:44
Tirumaleswara Reddy.K4-Feb-16 18:44 
AnswerRe: Insert Images in EditText as in Notes app in Android Mobiles Pin
Richard MacCutchan4-Feb-16 21:39
mveRichard MacCutchan4-Feb-16 21:39 
QuestionApp crash always. Why? Pin
Member 1226347731-Jan-16 7:37
Member 1226347731-Jan-16 7:37 
SuggestionRe: App crash always. Why? Pin
Kornfeld Eliyahu Peter31-Jan-16 8:17
professionalKornfeld Eliyahu Peter31-Jan-16 8:17 
GeneralRe: App crash always. Why? Pin
Member 122634771-Feb-16 6:39
Member 122634771-Feb-16 6:39 
MainActivity

Java
protected void onPostExecute(Integer result){
          //  Toast.makeText(getApplicationContext(),"onPostExecute",Toast.LENGTH_SHORT).show();
            if(result == 1){
                Toast.makeText(getApplicationContext(),"Result = 1",Toast.LENGTH_SHORT).show();
                //Stop showing ProgressDialog
                if(progressDialog.isShowing()){

                    progressDialog.dismiss();
                }


                Toast.makeText(getApplicationContext(),"onPostExecute",Toast.LENGTH_SHORT).show();

              //  arrayAdapter = new ArrayAdapter(MainActivity.this,R.layout.list_view,Title);
                Toast.makeText(getApplicationContext(),VideoID[0],Toast.LENGTH_SHORT).show();    //upto this working fine
               // AnotherCustom anotherCustom = new AnotherCustom();
                CustomAdapter customAdapter = new CustomAdapter(context,Title,VideoID);


               listView.setAdapter(arrayAdapter);


CustomAdapter

Java
 public CustomAdapter(Activity context,String[] Title,String[] VideoID){

        super(context,R.layout.activity_main,VideoID);
        this.context = context;
        this.Title = Title;
        this.VideoID = VideoID;

    }

    //This method is called when the list items are visible to user

    @Override
    public View getView(final int position,View convertView,ViewGroup parent){

    // Toast.makeText(context,"getView",Toast.LENGTH_SHORT).show();


        View ListItemView = convertView;

        if (convertView == null){

            LayoutInflater inflater = context.getLayoutInflater();
            ListItemView = inflater.inflate(R.layout.youtubethumbnail_loader,null,false);    //Inflating youtube thumbnail view layout


        }


       youTubeThumbnailView = (YouTubeThumbnailView)ListItemView.findViewById(R.id.youtubethumbnailviewnew);
        youTubeThumbnailView.initialize(Config.API_KEY, new YouTubeThumbnailView.OnInitializedListener() {


            @Override
            public void onInitializationSuccess(YouTubeThumbnailView thumbnailView, YouTubeThumbnailLoader thumbnailLoader) {

                Toast.makeText(context,"Success initialization",Toast.LENGTH_SHORT).show();
                youTubeThumbnailLoader = thumbnailLoader;

                thumbnailLoader.setOnThumbnailLoadedListener(new YouTubeThumbnailLoader.OnThumbnailLoadedListener() {
                    @Override
                    public void onThumbnailLoaded(YouTubeThumbnailView youTubeThumbnailView, String s) {


                        Toast.makeText(context, "Welcome to ShortFilmy", Toast.LENGTH_SHORT).show();

                    }

                    @Override
                    public void onThumbnailError(YouTubeThumbnailView youTubeThumbnailView, YouTubeThumbnailLoader.ErrorReason errorReason) {

                        Toast.makeText(context, "Failed to load thumbnail", Toast.LENGTH_SHORT).show();

                    }
                });

                thumbnailLoader.setVideo(VideoID[position]);  //setting video id to getting thumbnail

            }

            @Override
            public void onInitializationFailure(YouTubeThumbnailView youTubeThumbnailView, YouTubeInitializationResult youTubeInitializationResult) {


                Toast.makeText(context,"Failed to initialize",Toast.LENGTH_SHORT).show();

            }
        });

        textView = (TextView)ListItemView.findViewById(R.id.textViewnew);
        textView.setText(Title[position]);

        return ListItemView;
    }

}


Here,my customadapter is working fine when i used without asynctask but if I call customadapter class in asynctask(onPostExecute method) it'll force close my app. I googled a lot about this but i didn't know what to do for this.. But I heard that every app wants to view the widgets or anything within 5 secs in UI thread otherwise our app got crashed.So you guys wanna help me out...
GeneralRe: App crash always. Why? Pin
Richard MacCutchan4-Feb-16 1:13
mveRichard MacCutchan4-Feb-16 1:13 
QuestionHow to inflate the youtubethumbnailview ? Pin
Member 1226347726-Jan-16 0:11
Member 1226347726-Jan-16 0:11 
AnswerRe: How to inflate the youtubethumbnailview ? Pin
Afzaal Ahmad Zeeshan26-Jan-16 0:34
professionalAfzaal Ahmad Zeeshan26-Jan-16 0:34 
Questioncant recive data from WebService via Android ksoap2 Pin
goldsoft24-Jan-16 9:18
goldsoft24-Jan-16 9:18 
AnswerRe: cant recive data from WebService via Android ksoap2 Pin
Afzaal Ahmad Zeeshan26-Jan-16 0:42
professionalAfzaal Ahmad Zeeshan26-Jan-16 0:42 
QuestionHow to retrieve data in sqlite with intent Pin
Muhammad H Alhasanat22-Jan-16 22:51
Muhammad H Alhasanat22-Jan-16 22:51 
AnswerRe: How to retrieve data in sqlite with intent Pin
Richard MacCutchan23-Jan-16 0:19
mveRichard MacCutchan23-Jan-16 0:19 
GeneralRe: How to retrieve data in sqlite with intent Pin
Muhammad H Alhasanat23-Jan-16 1:03
Muhammad H Alhasanat23-Jan-16 1:03 
QuestionRe: How to retrieve data in sqlite with intent Pin
David Crow23-Jan-16 11:03
David Crow23-Jan-16 11:03 
AnswerRe: How to retrieve data in sqlite with intent Pin
Muhammad H Alhasanat24-Jan-16 1:26
Muhammad H Alhasanat24-Jan-16 1:26 
QuestionRe: How to retrieve data in sqlite with intent Pin
David Crow25-Jan-16 2:48
David Crow25-Jan-16 2:48 
AnswerRe: How to retrieve data in sqlite with intent Pin
Muhammad H Alhasanat25-Jan-16 22:30
Muhammad H Alhasanat25-Jan-16 22:30 
GeneralRe: How to retrieve data in sqlite with intent Pin
David Crow26-Jan-16 2:04
David Crow26-Jan-16 2:04 
GeneralRe: How to retrieve data in sqlite with intent Pin
Richard MacCutchan26-Jan-16 2:30
mveRichard MacCutchan26-Jan-16 2:30 
QuestionWhat is the difference between creating instance like this? Pin
Member 1226347721-Jan-16 22:07
Member 1226347721-Jan-16 22:07 
AnswerRe: What is the difference between creating instance like this? Pin
Richard MacCutchan21-Jan-16 22:43
mveRichard MacCutchan21-Jan-16 22:43 
QuestionPull to Refresh in List view Android Pin
Tirumaleswara Reddy.K21-Jan-16 20:06
Tirumaleswara Reddy.K21-Jan-16 20:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.