انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
درخواست کمک

درخواست کمک

#1
سلام من  یه برنامه با دیتابیس درست کردم و دیتابیس من دو تیبل داره من هر دو تیبل هم تونستم داخل دو اکتویتی جدا گانه بیارم بالا کسی هست راهنمایم کنه چطور میتونم دو تیبل داخل یه اکتویتی اجرا کنم.
 
پاسخ

درخواست کمک

#2
 
کد پی‌اچ‌پی:
package com.androidbegin.sidemenutabstutorial;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.IBinder;
import android.widget.Toast;


public class 
MyServic extends Service {

    private static final 
int NOT_ID 1;
    private 
database         db;

    private static 
int       b      0;


    @
SuppressWarnings("deprecation")
    @
Override
    
public int onStartCommand(Intent intentint flagsint startId) {
        
db = new database(this);
        
db.useable();
        try {
            new 
DoBackgroundTask("http://refairan.com/getcount.php").execute();

        }
        catch (
Exception e) {

        }
        
Toast.makeText(this"" "kavos"Toast.LENGTH_LONG).show();

        if (
0) {
            
String ns Context.NOTIFICATION_SERVICE;
            
NotificationManager mNotificationManager = (NotificationManagergetSystemService(ns);

            
int icon R.drawable.ic_action_history;
            
CharSequence tickerText " بیمه سامان ";
            
long when System.currentTimeMillis();

            
int requestID = (int) System.currentTimeMillis();
            
Notification notification = new Notification(icontickerTextwhen);
            
Context context getApplicationContext();
            
Intent notificationIntent = new Intent(thistakhfifat_bime.class);
            
//notificationIntent.putExtra("data1", "My Data 1");
            //  notificationIntent.putExtra("data2", "My Data 2");
            //  notificationIntent.setAction("myString" + requestID);
            
PendingIntent contentIntent PendingIntent.getActivity(thisrequestIDnotificationIntent0);
            
notificationIntent.setData((Uri.parse("mystring" requestID)));
            
notification.setLatestEventInfo(context"Notification Demo"requestID ""contentIntent);
            
notification.flags += Notification.FLAG_ONGOING_EVENT;
            
notification.flags += Notification.FLAG_AUTO_CANCEL;
            
mNotificationManager.notify(NOT_IDnotification);
            
0;

        } else {

            
Toast.makeText(this"kavos" bToast.LENGTH_LONG).show();
        }

        return 
Service.START_STICKY;
    }


    @
Override
    
public IBinder onBind(Intent arg0) {
        
// TODO Auto-generated method stub
        
return null;
    }


    private class 
DoBackgroundTask extends AsyncTask<URLIntegerString> {

        private 
String Link "";

        private 
String countS;


        public 
DoBackgroundTask(String link) {
            
Link link;

        }


        @
Override
        
protected String doInBackground(URL... arg0) {
            try {

                
URL mylink = new URL(Link);
                
URLConnection connect mylink.openConnection();

                
BufferedReader reader = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                
StringBuilder sb = new StringBuilder();
                
String line null;
                while ((
line reader.readLine()) != null) {
                    
sb.append(line);
                }

                
countS sb.toString();

            }

            catch (
Exception e) {

            }
            return 
countS;
        }


        @
Override
        
protected void onPostExecute(String result) {
            
super.onPostExecute(result);

            
db.open();
            
int countL db.count_inbox("takhfifat_bime");
            
db.close();
            
Integer.parseInt(result) - countL;

        }

    }


 
کد پی‌اچ‌پی:
Intent intent = new Intent(thisMyServic.class);
        
startService(intent); 
من این کلاس سرویس را فراخوانی کردم ولی برنامه بسته می شود دیگر اجرا نمی شود ولی مطلبی در سایت نوشته بود فقط یکبار اجرا شد لطفا راهنمایی کنید 
 
پاسخ
 سپاس شده توسط شماره مجازی امارات ، تلگرام ضد فیلتر 2023


پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان